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

SamboyCoding / Cpp2IL / 15051534503

15 May 2025 05:35PM UTC coverage: 34.038% (-0.4%) from 34.453%
15051534503

Pull #451

github

web-flow
Merge c857b5679 into d3bbbb38e
Pull Request #451: Support injecting anything

1774 of 6622 branches covered (26.79%)

Branch coverage included in aggregate %.

147 of 196 new or added lines in 27 files covered. (75.0%)

53 existing lines in 2 files now uncovered.

4155 of 10797 relevant lines covered (38.48%)

188267.61 hits per line

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

64.81
/Cpp2IL.Core/Model/Contexts/PropertyAnalysisContext.cs
1
using System;
2
using System.Reflection;
3
using Cpp2IL.Core.Utils;
4
using LibCpp2IL.Metadata;
5
using StableNameDotNet.Providers;
6

7
namespace Cpp2IL.Core.Model.Contexts;
8

9
public class PropertyAnalysisContext : HasCustomAttributesAndName, IPropertyInfoProvider
10
{
11
    public TypeAnalysisContext DeclaringType { get; }
178,765✔
12
    public Il2CppPropertyDefinition? Definition { get; }
125,965✔
13

14
    public MethodAnalysisContext? Getter { get; }
15,362✔
15
    public MethodAnalysisContext? Setter { get; }
15,360✔
16

17
    protected override int CustomAttributeIndex => Definition?.customAttributeIndex ?? -1;
64,512!
18

19
    public override AssemblyAnalysisContext CustomAttributeAssembly => DeclaringType.DeclaringAssembly;
163,404✔
20

21
    public override string DefaultName => Definition?.Name ?? throw new($"Subclasses must override {nameof(DefaultName)}.");
15,370!
22

23
    public virtual bool IsStatic => Definition?.IsStatic ?? throw new($"Subclasses must override {nameof(IsStatic)}.");
15,360!
24

25
    public virtual PropertyAttributes PropertyAttributes => (PropertyAttributes?)Definition?.attrs ?? throw new($"Subclasses must override {nameof(PropertyAttributes)}.");
15,360!
26

27
    public virtual TypeAnalysisContext PropertyTypeContext => DeclaringType.DeclaringAssembly.ResolveIl2CppType(Definition?.RawPropertyType)
15,360!
28
        ?? throw new($"Subclasses must override {nameof(PropertyTypeContext)}.");
15,360✔
29

30
    public PropertyAnalysisContext(Il2CppPropertyDefinition definition, TypeAnalysisContext parent) : base(definition.token, parent.AppContext)
75,972✔
31
    {
32
        DeclaringType = parent;
75,972✔
33
        Definition = definition;
75,972✔
34

35
        InitCustomAttributeData();
75,972✔
36

37
        Getter = parent.GetMethod(definition.Getter);
75,972✔
38
        Setter = parent.GetMethod(definition.Setter);
75,972✔
39
    }
75,972✔
40

41
    protected PropertyAnalysisContext(MethodAnalysisContext? getter, MethodAnalysisContext? setter, TypeAnalysisContext parent) : base(0, parent.AppContext)
42✔
42
    {
43
        if (getter is null && setter is null)
42!
NEW
44
            throw new ArgumentException("Property must have at least one method");
×
45

46
        DeclaringType = parent;
42✔
47
        Getter = getter;
42✔
48
        Setter = setter;
42✔
49
    }
42✔
50

NEW
51
    public override string ToString() => $"Property:  {DeclaringType.Name}::{Name}";
×
52

53
    #region StableNameDotNet implementation
54

55
    public ITypeInfoProvider PropertyTypeInfoProvider
56
        => Definition.RawPropertyType!.ThisOrElementIsGenericParam()
×
57
            ? new GenericParameterTypeInfoProviderWrapper(Definition.RawPropertyType!.GetGenericParamName())
×
58
            : TypeAnalysisContext.GetSndnProviderForType(AppContext, Definition.RawPropertyType!);
×
59

60
    public string PropertyName => Name;
×
61

62
    #endregion
63
}
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