Skip to content

Commit f2cf2ad

Browse files
committed
Support null Definition for CustomAttributeIndex
* Added null branch for Definition, so that it doesn't throw for InjectedTypeAnalysisContext * Removed redundant overrides in ReferencedTypeAnalysisContext
1 parent 6af99f2 commit f2cf2ad

2 files changed

Lines changed: 1 addition & 5 deletions

File tree

Cpp2IL.Core/Model/Contexts/ReferencedTypeAnalysisContext.cs

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -11,10 +11,6 @@ public abstract class ReferencedTypeAnalysisContext(AssemblyAnalysisContext refe
1111
{
1212
public override Il2CppTypeEnum Type => throw new NotImplementedException("Type must be set by derived classes");
1313

14-
protected override int CustomAttributeIndex => -1;
15-
16-
public override AssemblyAnalysisContext CustomAttributeAssembly => DeclaringAssembly;
17-
1814
public override string ToString()
1915
{
2016
return DefaultName;

Cpp2IL.Core/Model/Contexts/TypeAnalysisContext.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@ public class TypeAnalysisContext : HasGenericParameters, ITypeInfoProvider, ICSh
5353
/// </summary>
5454
public List<TypeAnalysisContext> NestedTypes { get; internal set; } = [];
5555

56-
protected override int CustomAttributeIndex => Definition!.CustomAttributeIndex;
56+
protected override int CustomAttributeIndex => Definition?.CustomAttributeIndex ?? -1;
5757

5858
public override AssemblyAnalysisContext CustomAttributeAssembly => DeclaringAssembly;
5959

0 commit comments

Comments
 (0)