Skip to content

Commit

Permalink
MethodUsedByAnalyzer: Fix detection of usages in expression trees.
Browse files Browse the repository at this point in the history
  • Loading branch information
siegfriedpammer committed Aug 9, 2018
1 parent 822f358 commit c753b65
Showing 1 changed file with 5 additions and 7 deletions.
12 changes: 5 additions & 7 deletions ILSpy/Analyzers/Builtin/MethodUsedByAnalyzer.cs
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,7 @@ static bool ScanMethodBody(IMethod analyzedMethod, IMethod method, MethodBodyBlo
ILOpCode opCode;
try {
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);
continue;
}
Expand All @@ -118,16 +118,14 @@ static bool ScanMethodBody(IMethod analyzedMethod, IMethod method, MethodBodyBlo
if (m == null)
continue;

if (opCode == ILOpCode.Call) {
if (IsSameMember(analyzedMethod, m)) {
return true;
}
}

if (opCode == ILOpCode.Callvirt && baseMethod != null) {
if (IsSameMember(baseMethod, m)) {
return true;
}
} else {
if (IsSameMember(analyzedMethod, m)) {
return true;
}
}
}

Expand Down

0 comments on commit c753b65

Please sign in to comment.