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

SamboyCoding / Cpp2IL / 15172415984

21 May 2025 08:56PM UTC coverage: 34.294% (+0.2%) from 34.062%
15172415984

Pull #462

github

web-flow
Merge 483c13920 into 5807d2b6c
Pull Request #462: Support overriding member types

1801 of 6644 branches covered (27.11%)

Branch coverage included in aggregate %.

128 of 232 new or added lines in 35 files covered. (55.17%)

5 existing lines in 5 files now uncovered.

4199 of 10852 relevant lines covered (38.69%)

186271.78 hits per line

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

77.78
/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

NEW
17
    public sealed override string DefaultNamespace => "";
×
18

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

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

23
    public new GenericParameterAttributes DefaultAttributes { get; }
2,260✔
24
    public new GenericParameterAttributes? OverrideAttributes { get; set; }
2,260✔
25
    public new GenericParameterAttributes Attributes => OverrideAttributes ?? DefaultAttributes;
2,260!
26

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

37
    public HasGenericParameters Owner { get; }
×
38

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

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

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