• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In

SamboyCoding / Cpp2IL / 12320749043

13 Dec 2024 06:07PM UTC coverage: 27.79% (-0.3%) from 28.128%
12320749043

Pull #393

github

web-flow
Merge b9caa35d0 into ac99859af
Pull Request #393: Add Type field to AttributeAttribute

1268 of 6370 branches covered (19.91%)

Branch coverage included in aggregate %.

3 of 93 new or added lines in 7 files covered. (3.23%)

45 existing lines in 4 files now uncovered.

3386 of 10377 relevant lines covered (32.63%)

123656.67 hits per line

Source File
Press 'n' to go to next uncovered line, 'b' for previous

34.38
/Cpp2IL.Core/Model/CustomAttributes/CustomAttributeTypeParameter.cs
1
using System.IO;
2
using Cpp2IL.Core.Extensions;
3
using Cpp2IL.Core.Model.Contexts;
4
using Cpp2IL.Core.Utils;
5
using LibCpp2IL;
6
using LibCpp2IL.BinaryStructures;
7

8
namespace Cpp2IL.Core.Model.CustomAttributes;
9

10
/// <summary>
11
/// Represents a <see cref="BaseCustomAttributeTypeParameter"/> for a <see cref="Il2CppType"/>.
12
/// </summary>
13
public class CustomAttributeTypeParameter : BaseCustomAttributeTypeParameter
14
{
15
    private Il2CppType? _type;
16
    private TypeAnalysisContext? _typeContext;
17

18
    public override TypeAnalysisContext? TypeContext
19
    {
20
        get
21
        {
22
            return _typeContext ??= Owner.Constructor.CustomAttributeAssembly.ResolveIl2CppType(_type);
1✔
23
        }
24
    }
25

26
    public CustomAttributeTypeParameter(Il2CppType? type, AnalyzedCustomAttribute owner, CustomAttributeParameterKind kind, int index) : base(owner, kind, index)
×
27
    {
NEW
28
        _type = type;
×
NEW
29
    }
×
30

NEW
31
    public CustomAttributeTypeParameter(TypeAnalysisContext? type, AnalyzedCustomAttribute owner, CustomAttributeParameterKind kind, int index) : base(owner, kind, index)
×
32
    {
NEW
33
        _typeContext = type;
×
UNCOV
34
    }
×
35

36
    public CustomAttributeTypeParameter(AnalyzedCustomAttribute owner, CustomAttributeParameterKind kind, int index) : base(owner, kind, index)
2✔
37
    {
38
    }
2✔
39

40
    public override void ReadFromV29Blob(BinaryReader reader, ApplicationAnalysisContext context)
41
    {
42
        var typeIndex = reader.BaseStream.ReadUnityCompressedInt();
2✔
43
        if (typeIndex == -1)
2!
NEW
44
            _type = null;
×
45
        else
46
        {
47
            _type = context.Binary.GetType(typeIndex);
2✔
48
        }
49
        _typeContext = null;
2✔
50
    }
2✔
51

52
    public override string ToString()
53
    {
NEW
54
        if (TypeContext == null)
×
55
            return "(Type) null";
×
56

NEW
57
        if (TypeContext.IsPrimitive)
×
NEW
58
            return $"typeof({LibCpp2ILUtils.GetTypeName(TypeContext.Type)}";
×
59

NEW
60
        if (TypeContext is ReferencedTypeAnalysisContext)
×
61
        {
NEW
62
            return $"typeof({TypeContext.GetCSharpSourceString()})";
×
63
        }
64

65
        //Basic class/struct
NEW
66
        return $"typeof({TypeContext.Name})";
×
67
    }
68
}
STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2025 Coveralls, Inc