Skip to content

Commit

Permalink
Core: Fix exception when converting InjectedParameterAnalysisContext …
Browse files Browse the repository at this point in the history
…to AsmResolver
  • Loading branch information
SamboyCoding committed Aug 31, 2024
1 parent 87c61bd commit 4184388
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 2 deletions.
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
using System.Reflection;
using Cpp2IL.Core.Utils;
using LibCpp2IL.BinaryStructures;

Expand All @@ -7,7 +8,9 @@ public class InjectedParameterAnalysisContext : ParameterAnalysisContext
{
public override TypeAnalysisContext ParameterTypeContext { get; }

public override bool IsRef => false; //For now
public override bool IsRef => ParameterTypeContext is ReferencedTypeAnalysisContext;

public override ParameterAttributes ParameterAttributes => ParameterAttributes.None;

public InjectedParameterAnalysisContext(string? name, Il2CppType type, int paramIndex, MethodAnalysisContext declaringMethod)
: this(name, declaringMethod.DeclaringType!.DeclaringAssembly.ResolveIl2CppType(type) ?? throw new($"Type {type} could not be resolved."), paramIndex, declaringMethod)
Expand Down
2 changes: 1 addition & 1 deletion Cpp2IL.Core/Model/Contexts/ParameterAnalysisContext.cs
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ public class ParameterAnalysisContext : HasCustomAttributesAndName, IParameterIn
/// <summary>
/// The ParameterAttributes of this parameter.
/// </summary>
public ParameterAttributes ParameterAttributes => (ParameterAttributes)ParameterType.Attrs;
public virtual ParameterAttributes ParameterAttributes => (ParameterAttributes)ParameterType.Attrs;

/// <summary>
/// True if this parameter is passed by reference.
Expand Down

0 comments on commit 4184388

Please sign in to comment.