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

SamboyCoding / Cpp2IL / 15051062495

15 May 2025 05:10PM UTC coverage: 34.039% (-0.4%) from 34.453%
15051062495

Pull #451

github

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

1774 of 6622 branches covered (26.79%)

Branch coverage included in aggregate %.

147 of 195 new or added lines in 27 files covered. (75.38%)

53 existing lines in 2 files now uncovered.

4155 of 10796 relevant lines covered (38.49%)

188285.05 hits per line

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

78.13
/Cpp2IL.Core/Model/Contexts/GenericParameterTypeAnalysisContext.cs
1
using System;
2
using System.Collections.Generic;
3
using System.Linq;
4
using System.Reflection;
5
using Cpp2IL.Core.Utils;
6
using LibCpp2IL.BinaryStructures;
7
using LibCpp2IL.Metadata;
8

9
namespace Cpp2IL.Core.Model.Contexts;
10

11
public class GenericParameterTypeAnalysisContext : ReferencedTypeAnalysisContext
12
{
13
    private readonly Il2CppGenericParameter? definition;
14

15
    public sealed override string DefaultName { get; }
2,260✔
16

17
    public sealed override string DefaultNs => "";
×
18

19
    public int Index { get; }
212,244✔
20

21
    public override Il2CppTypeEnum Type { get; }
212,244✔
22

23
    public GenericParameterAttributes Attributes { get; }
2,260✔
24

25
    private List<TypeAnalysisContext>? _constraintTypes;
26
    public List<TypeAnalysisContext> ConstraintTypes
27
    {
28
        get
29
        {
30
            _constraintTypes ??= definition?.ConstraintTypes.Select(t => DeclaringAssembly.ResolveIl2CppType(t)).ToList() ?? [];
2,635!
31
            return _constraintTypes;
2,260✔
32
        }
33
    }
34

NEW
35
    public HasGenericParameters Owner { get; }
×
36

37
    /// <summary>
38
    /// This should only be used by the initializers for <see cref="TypeAnalysisContext.GenericParameters"/> and <see cref="MethodAnalysisContext.GenericParameters"/>.
39
    /// It ensures that generic parameters are only held by their owners.
40
    /// </summary>
41
    internal GenericParameterTypeAnalysisContext(Il2CppGenericParameter genericParameter, HasGenericParameters owner)
42
        : this(genericParameter.Name ?? "T", genericParameter.genericParameterIndexInOwner, genericParameter.Type, genericParameter.Attributes, owner)
10,915!
43
    {
44
        definition = genericParameter;
10,915✔
45
    }
10,915✔
46

47
    public GenericParameterTypeAnalysisContext(string name, int index, Il2CppTypeEnum type, GenericParameterAttributes attributes, HasGenericParameters owner) : base(owner.CustomAttributeAssembly)
10,915✔
48
    {
49
        if (type is not Il2CppTypeEnum.IL2CPP_TYPE_VAR and not Il2CppTypeEnum.IL2CPP_TYPE_MVAR)
10,915!
50
            throw new ArgumentException($"Generic parameter type is not a generic parameter, but {type}", nameof(type));
×
51

52
        DefaultName = name;
10,915✔
53
        Index = index;
10,915✔
54
        Type = type;
10,915✔
55
        Attributes = attributes;
10,915✔
56
        Owner = owner;
10,915✔
57
    }
10,915✔
58
}
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