Skip to content

Commit

Permalink
Core: DummyDll: Fix valuetype not being set on type references
Browse files Browse the repository at this point in the history
  • Loading branch information
SamboyCoding committed Jun 25, 2024
1 parent c56e809 commit 138e379
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,8 @@ public class GenericInstanceTypeAnalysisContext : ReferencedTypeAnalysisContext

public sealed override int GenericParameterCount => GenericArguments.Count;

public sealed override bool IsValueType => GenericType.IsValueType; //We don't set a definition so the default implementation cannot determine if we're a value type or not.

public GenericInstanceTypeAnalysisContext(Il2CppType rawType, AssemblyAnalysisContext referencedFrom) : base(referencedFrom)
{
//Generic type has to be a type definition
Expand Down
2 changes: 1 addition & 1 deletion Cpp2IL.Core/Model/Contexts/TypeAnalysisContext.cs
Original file line number Diff line number Diff line change
Expand Up @@ -232,7 +232,7 @@ public static ITypeInfoProvider GetSndnProviderForType(ApplicationAnalysisContex
public string RewrittenTypeName => Name;
public string TypeNamespace => Namespace;
public virtual bool IsGenericInstance => false;
public bool IsValueType => Definition?.IsValueType ?? BaseType is { Namespace: "System", Name: "ValueType" };
public virtual bool IsValueType => Definition?.IsValueType ?? BaseType is { Namespace: "System", Name: "ValueType" };
public bool IsEnumType => Definition?.IsEnumType ?? BaseType is { Namespace: "System", Name: "Enum" };
public bool IsInterface => Definition?.IsInterface ?? ((TypeAttributes & TypeAttributes.Interface) != default);
public IEnumerable<ITypeInfoProvider> GenericArgumentInfoProviders => Array.Empty<ITypeInfoProvider>();
Expand Down
2 changes: 2 additions & 0 deletions Cpp2IL.Core/Model/Contexts/WrappedTypeAnalysisContext.cs
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,8 @@ public abstract class WrappedTypeAnalysisContext : ReferencedTypeAnalysisContext

public override string DefaultNs => ElementType.Namespace;

public override bool IsValueType => ElementType.IsValueType; //We don't set a definition so the default implementation cannot determine if we're a value type or not.

protected WrappedTypeAnalysisContext(TypeAnalysisContext elementType, AssemblyAnalysisContext referencedFrom) : base(referencedFrom)
{
ElementType = elementType;
Expand Down

0 comments on commit 138e379

Please sign in to comment.