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

SamboyCoding / Cpp2IL / 20488056168

24 Dec 2025 02:19PM UTC coverage: 34.361% (+0.05%) from 34.31%
20488056168

Pull #499

github

web-flow
Merge 482cdd13f into 3a72c253a
Pull Request #499: Add ResolveContextForMethod overload taking Cpp2IlMethodRef as a parameter

1811 of 6624 branches covered (27.34%)

Branch coverage included in aggregate %.

0 of 3 new or added lines in 1 file covered. (0.0%)

187 existing lines in 10 files now uncovered.

4208 of 10893 relevant lines covered (38.63%)

201355.63 hits per line

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

60.0
/Cpp2IL.Core/Model/Contexts/EventAnalysisContext.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 EventAnalysisContext : HasCustomAttributesAndName, IEventInfoProvider
10
{
11
    public readonly TypeAnalysisContext DeclaringType;
12
    public readonly Il2CppEventDefinition? Definition;
13
    public readonly MethodAnalysisContext? Adder;
14
    public readonly MethodAnalysisContext? Remover;
15
    public readonly MethodAnalysisContext? Invoker;
16

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

19
    public override AssemblyAnalysisContext CustomAttributeAssembly => DeclaringType.DeclaringAssembly;
840✔
20

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

23
    public virtual EventAttributes DefaultAttributes => (EventAttributes?)Definition?.RawType?.Attrs ?? throw new($"Subclasses must override {nameof(DefaultAttributes)}.");
75!
24

25
    public EventAttributes? OverrideAttributes { get; set; }
75✔
26

27
    public EventAttributes Attributes
28
    {
29
        get => OverrideAttributes ?? DefaultAttributes;
75!
UNCOV
30
        set => OverrideAttributes = value;
×
31
    }
32

33
    public virtual TypeAnalysisContext DefaultEventType => DeclaringType.DeclaringAssembly.ResolveIl2CppType(Definition?.RawType) ?? throw new($"Subclasses must override {nameof(DefaultEventType)}.");
75!
34

35
    public TypeAnalysisContext? OverrideEventType { get; set; }
76✔
36

37
    public TypeAnalysisContext EventType
38
    {
39
        get => OverrideEventType ?? DefaultEventType;
76✔
UNCOV
40
        set => OverrideEventType = value;
×
41
    }
42

UNCOV
43
    public virtual bool IsStatic => Definition?.IsStatic ?? throw new($"Subclasses must override {nameof(IsStatic)}.");
×
44

45
    public EventAnalysisContext(Il2CppEventDefinition definition, TypeAnalysisContext parent) : base(definition.token, parent.AppContext)
405✔
46
    {
47
        Definition = definition;
405✔
48
        DeclaringType = parent;
405✔
49

50
        InitCustomAttributeData();
405✔
51

52
        Adder = parent.GetMethod(definition.Adder);
405✔
53
        Remover = parent.GetMethod(definition.Remover);
405✔
54
        Invoker = parent.GetMethod(definition.Invoker);
405✔
55
    }
405✔
56

57
    protected EventAnalysisContext(MethodAnalysisContext? adder, MethodAnalysisContext? remover, MethodAnalysisContext? invoker, TypeAnalysisContext parent) : base(0, parent.AppContext)
42✔
58
    {
59
        if (adder is null && remover is null && invoker is null)
42!
60
            throw new ArgumentException("Event must have at least one method");
×
61

62
        DeclaringType = parent;
42✔
63
        Adder = adder;
42✔
64
        Remover = remover;
42✔
65
        Invoker = invoker;
42✔
66
    }
42✔
67

68
    public override string ToString() => $"Event: {DeclaringType.Name}::{Name}";
×
69

70
    #region StableNameDotNet Impl
71

UNCOV
72
    public ITypeInfoProvider EventTypeInfoProvider => Definition!.RawType!.ThisOrElementIsGenericParam()
×
UNCOV
73
        ? new GenericParameterTypeInfoProviderWrapper(Definition.RawType!.GetGenericParamName())
×
UNCOV
74
        : TypeAnalysisContext.GetSndnProviderForType(AppContext, Definition.RawType!);
×
75

UNCOV
76
    public string EventName => Name;
×
77

78
    #endregion
79
}
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

© 2026 Coveralls, Inc