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

SamboyCoding / Cpp2IL / 20487925661

24 Dec 2025 02:11PM UTC coverage: 34.275% (-0.04%) from 34.31%
20487925661

push

github

SamboyCoding
Other properties too

This also makes ParameterAnalysisContext::ParameterType not virtual

1791 of 6588 branches covered (27.19%)

Branch coverage included in aggregate %.

10 of 20 new or added lines in 7 files covered. (50.0%)

129 existing lines in 7 files now uncovered.

4191 of 10865 relevant lines covered (38.57%)

180313.71 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;
315!
18

19
    public override AssemblyAnalysisContext CustomAttributeAssembly => DeclaringType.DeclaringAssembly;
720✔
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✔
NEW
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)
345✔
46
    {
47
        Definition = definition;
345✔
48
        DeclaringType = parent;
345✔
49

50
        InitCustomAttributeData();
345✔
51

52
        Adder = parent.GetMethod(definition.Adder);
345✔
53
        Remover = parent.GetMethod(definition.Remover);
345✔
54
        Invoker = parent.GetMethod(definition.Invoker);
345✔
55
    }
345✔
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!
UNCOV
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

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