From 3606542f5bed93038460ef69e5da411c6993d4f0 Mon Sep 17 00:00:00 2001 From: Siegfried Pammer Date: Thu, 4 Oct 2018 14:26:24 +0200 Subject: [PATCH] Fix #1290: Missing ldftn/ldvirtftn usages of methods. --- ILSpy/Analyzers/Builtin/MethodUsedByAnalyzer.cs | 16 +++++++++++++++- 1 file changed, 15 insertions(+), 1 deletion(-) diff --git a/ILSpy/Analyzers/Builtin/MethodUsedByAnalyzer.cs b/ILSpy/Analyzers/Builtin/MethodUsedByAnalyzer.cs index 6398d8799..fd4d6b59c 100644 --- a/ILSpy/Analyzers/Builtin/MethodUsedByAnalyzer.cs +++ b/ILSpy/Analyzers/Builtin/MethodUsedByAnalyzer.cs @@ -99,7 +99,7 @@ namespace ICSharpCode.ILSpy.Analyzers.Builtin ILOpCode opCode; try { opCode = blob.DecodeOpCode(); - if (opCode != ILOpCode.Call && opCode != ILOpCode.Callvirt && opCode != ILOpCode.Ldtoken) { + if (!IsSupportedOpCode(opCode)) { ILParser.SkipOperand(ref blob, opCode); continue; } @@ -132,6 +132,20 @@ namespace ICSharpCode.ILSpy.Analyzers.Builtin return false; } + static bool IsSupportedOpCode(ILOpCode opCode) + { + switch (opCode) { + case ILOpCode.Call: + case ILOpCode.Callvirt: + case ILOpCode.Ldtoken: + case ILOpCode.Ldftn: + case ILOpCode.Ldvirtftn: + return true; + default: + return false; + } + } + static bool IsSameMember(IMember analyzedMethod, IMember m) { return m.MetadataToken == analyzedMethod.MetadataToken