Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 18 additions & 2 deletions MetadataProvider/AssemblyExtractor.cs
Original file line number Diff line number Diff line change
Expand Up @@ -971,8 +971,10 @@ private IInstruction ExtractInstruction(ILInstruction operation)
break;

case SRM.ILOpCode.Ldftn:
instruction = ProcessLoadMethodAddress(operation, false);
break;
case SRM.ILOpCode.Ldvirtftn:
instruction = ProcessLoadMethodAddress(operation);
instruction = ProcessLoadMethodAddress(operation, true);
break;

case SRM.ILOpCode.Ldc_i4:
Expand Down Expand Up @@ -1573,10 +1575,24 @@ private IInstruction ProcessLoadField(ILInstruction op)
return instruction;
}

private IInstruction ProcessLoadMethodAddress(ILInstruction op)
private IInstruction ProcessLoadMethodAddress(ILInstruction op, bool isVirtual)
{
var operation = OperationHelper.ToLoadMethodAddressOperation(op.Opcode);
var method = GetOperand<IMethodReference>(op);
switch (method)
{
case MethodDefinition methodDefinition:
{
methodDefinition.IsVirtual = isVirtual;
break;
}
case MethodReference methodReference:
{
methodReference.IsVirtual = isVirtual;
break;
}
default: throw new Exception("case not handled");
}

var instruction = new LoadMethodAddressInstruction(op.Offset, operation, method);
return instruction;
Expand Down
2 changes: 2 additions & 0 deletions Model/Types/TypeDefinitions.cs
Original file line number Diff line number Diff line change
Expand Up @@ -286,6 +286,7 @@ public interface IMethodReference : ITypeMemberReference, IMetadataReference, IG
IMethodReference GenericMethod { get; }
MethodDefinition ResolvedMethod { get; }
bool IsStatic { get; }
bool IsVirtual { get; }
}

public class MethodReference : IMethodReference
Expand All @@ -302,6 +303,7 @@ public class MethodReference : IMethodReference
public IList<IMethodParameterReference> Parameters { get; private set; }
public IMethodReference GenericMethod { get; set; }
public bool IsStatic { get; set; }
public bool IsVirtual { get; set; }

public MethodReference(string name, IType returnType)
{
Expand Down