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

SamboyCoding / Cpp2IL / 25637406031

10 May 2026 07:15PM UTC coverage: 35.332% (+0.04%) from 35.296%
25637406031

Pull #546

github

web-flow
Merge c0906220b into 0b8509573
Pull Request #546: Replace arrays with IEnumerable<> in InjectedMethodAnalysisContext constructor

1979 of 6985 branches covered (28.33%)

Branch coverage included in aggregate %.

16 of 23 new or added lines in 1 file covered. (69.57%)

4497 of 11344 relevant lines covered (39.64%)

252490.86 hits per line

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

59.68
/Cpp2IL.Core/Model/Contexts/InjectedMethodAnalysisContext.cs
1
using System.Collections.Generic;
2
using System.Reflection;
3

4
namespace Cpp2IL.Core.Model.Contexts;
5

6
public class InjectedMethodAnalysisContext : MethodAnalysisContext
7
{
8
    public override ulong UnderlyingPointer => 0;
×
9

10
    public override string DefaultName { get; }
3✔
11

12
    public override TypeAnalysisContext DefaultReturnType { get; }
3✔
13

14
    public override MethodAttributes DefaultAttributes { get; }
×
15

16
    public override MethodImplAttributes DefaultImplAttributes { get; }
×
17

18
    protected override bool IsInjected => true;
×
19

20
    protected override int CustomAttributeIndex => -1;
×
21

22
    public InjectedMethodAnalysisContext(
23
        TypeAnalysisContext parent,
24
        string name,
25
        TypeAnalysisContext returnType,
26
        MethodAttributes attributes,
27
        IEnumerable<TypeAnalysisContext> injectedParameterTypes,
28
        IEnumerable<string>? injectedParameterNames = null,
29
        IEnumerable<ParameterAttributes>? injectedParameterAttributes = null,
30
        MethodImplAttributes implAttributes = MethodImplAttributes.Managed) : this(parent, name, returnType, attributes, GetParameters(injectedParameterTypes, injectedParameterNames, injectedParameterAttributes), implAttributes)
252✔
31
    {
32
    }
252✔
33

34
    public InjectedMethodAnalysisContext(
35
        TypeAnalysisContext parent,
36
        string name,
37
        TypeAnalysisContext returnType,
38
        MethodAttributes attributes,
39
        IEnumerable<(TypeAnalysisContext Type, string? Name, ParameterAttributes Attributes)> parameters,
40
        MethodImplAttributes implAttributes = MethodImplAttributes.Managed) : base(null, parent)
252✔
41
    {
42
        DefaultName = name;
252✔
43
        DefaultReturnType = returnType;
252✔
44
        DefaultAttributes = attributes;
252✔
45

46
        var i = 0;
252✔
47
        foreach (var (parameterType, parameterName, parameterAttributes) in parameters)
672✔
48
        {
49
            Parameters.Add(new InjectedParameterAnalysisContext(parameterName, parameterType, parameterAttributes, i, this));
84✔
50
            i++;
84✔
51
        }
52

53
        DefaultImplAttributes = implAttributes;
252✔
54
    }
252✔
55

56
    private static IEnumerable<(TypeAnalysisContext Type, string? Name, ParameterAttributes Attributes)> GetParameters(
57
        IEnumerable<TypeAnalysisContext> parameterTypes,
58
        IEnumerable<string>? parameterNames = null,
59
        IEnumerable<ParameterAttributes>? parameterAttributes = null)
60
    {
61
        var typeEnumerator = parameterTypes.GetEnumerator();
252✔
62
        var nameEnumerator = parameterNames?.GetEnumerator();
252!
63
        var attributeEnumerator = parameterAttributes?.GetEnumerator();
252!
64
        if (nameEnumerator != null)
252!
65
        {
NEW
66
            if (attributeEnumerator != null)
×
67
            {
NEW
68
                while (typeEnumerator.MoveNext() && nameEnumerator.MoveNext() && attributeEnumerator.MoveNext())
×
69
                {
NEW
70
                    yield return (typeEnumerator.Current, nameEnumerator.Current, attributeEnumerator.Current);
×
71
                }
72
            }
73
            else
74
            {
NEW
75
                while (typeEnumerator.MoveNext() && nameEnumerator.MoveNext())
×
76
                {
NEW
77
                    yield return (typeEnumerator.Current, nameEnumerator.Current, ParameterAttributes.None);
×
78
                }
79
            }
80
        }
81
        else
82
        {
83
            if (attributeEnumerator != null)
252!
84
            {
NEW
85
                while (typeEnumerator.MoveNext() && attributeEnumerator.MoveNext())
×
86
                {
NEW
87
                    yield return (typeEnumerator.Current, null, attributeEnumerator.Current);
×
88
                }
89
            }
90
            else
91
            {
92
                while (typeEnumerator.MoveNext())
336✔
93
                {
94
                    yield return (typeEnumerator.Current, null, ParameterAttributes.None);
84✔
95
                }
96
            }
97
        }
98
    }
252✔
99
}
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