Browse Source

MethodUsedByAnalyzer: Fix detection of usages in expression trees.

pull/1253/head
Siegfried Pammer 7 years ago
parent
commit
c753b65f08
  1. 12
      ILSpy/Analyzers/Builtin/MethodUsedByAnalyzer.cs

12
ILSpy/Analyzers/Builtin/MethodUsedByAnalyzer.cs

@ -99,7 +99,7 @@ namespace ICSharpCode.ILSpy.Analyzers.Builtin
ILOpCode opCode; ILOpCode opCode;
try { try {
opCode = blob.DecodeOpCode(); opCode = blob.DecodeOpCode();
if (opCode != ILOpCode.Call && opCode != ILOpCode.Callvirt) { if (opCode != ILOpCode.Call && opCode != ILOpCode.Callvirt && opCode != ILOpCode.Ldtoken) {
ILParser.SkipOperand(ref blob, opCode); ILParser.SkipOperand(ref blob, opCode);
continue; continue;
} }
@ -118,16 +118,14 @@ namespace ICSharpCode.ILSpy.Analyzers.Builtin
if (m == null) if (m == null)
continue; continue;
if (opCode == ILOpCode.Call) {
if (IsSameMember(analyzedMethod, m)) {
return true;
}
}
if (opCode == ILOpCode.Callvirt && baseMethod != null) { if (opCode == ILOpCode.Callvirt && baseMethod != null) {
if (IsSameMember(baseMethod, m)) { if (IsSameMember(baseMethod, m)) {
return true; return true;
} }
} else {
if (IsSameMember(analyzedMethod, m)) {
return true;
}
} }
} }

Loading…
Cancel
Save