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

SamboyCoding / Cpp2IL / 25639874807

10 May 2026 09:10PM UTC coverage: 35.33% (+0.03%) from 35.296%
25639874807

push

github

web-flow
Use ReadOnlySpan<> in InjectedMethodAnalysisContext (#547)

* Use ReadOnlySpan<> in InjectedMethodAnalysisContext

* Less Linq

1974 of 6973 branches covered (28.31%)

Branch coverage included in aggregate %.

10 of 12 new or added lines in 2 files covered. (83.33%)

4495 of 11337 relevant lines covered (39.65%)

252646.65 hits per line

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

65.79
/Cpp2IL.Core/Model/Contexts/InjectedMethodAnalysisContext.cs
1
using System;
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
        ReadOnlySpan<TypeAnalysisContext> injectedParameterTypes,
28
        ReadOnlySpan<string> injectedParameterNames = default,
29
        ReadOnlySpan<ParameterAttributes> injectedParameterAttributes = default,
30
        MethodImplAttributes defaultImplAttributes = MethodImplAttributes.Managed) : base(null, parent)
252✔
31
    {
32
        DefaultName = name;
252✔
33
        DefaultReturnType = returnType;
252✔
34
        DefaultAttributes = attributes;
252✔
35

36
        var hasParameterNames = !injectedParameterNames.IsEmpty;
252✔
37
        var hasParameterAttributes = !injectedParameterAttributes.IsEmpty;
252✔
38

39
        if (hasParameterNames && injectedParameterNames.Length != injectedParameterTypes.Length)
252!
NEW
40
            throw new ArgumentException("Length of injected parameter names must match length of injected parameter types.", nameof(injectedParameterNames));
×
41
        if (hasParameterAttributes && injectedParameterAttributes.Length != injectedParameterTypes.Length)
252!
NEW
42
            throw new ArgumentException("Length of injected parameter attributes must match length of injected parameter types.", nameof(injectedParameterAttributes));
×
43

44
        for (var i = 0; i < injectedParameterTypes.Length; i++)
672✔
45
        {
46
            var injectedParameterType = injectedParameterTypes[i];
84✔
47
            var injectedParameterName = hasParameterNames ? injectedParameterNames[i] : null;
84!
48
            var injectedParameterAttribute = hasParameterAttributes ? injectedParameterAttributes[i] : ParameterAttributes.None;
84!
49

50
            Parameters.Add(new InjectedParameterAnalysisContext(injectedParameterName, injectedParameterType, injectedParameterAttribute, i, this));
84✔
51
        }
52

53
        DefaultImplAttributes = defaultImplAttributes;
252✔
54
    }
252✔
55
}
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