예제 #1
0
 bool IsMethodCallOnVariable(ILInstruction inst, ILVariable variable)
 {
     if (inst.MatchLdLocRef(variable))
     {
         return(true);
     }
     if (inst is CallInstruction call && call.Arguments.Count > 0 && !call.Method.IsStatic)
     {
         return(IsMethodCallOnVariable(call.Arguments[0], variable));
     }
     if (inst.MatchLdFld(out var target, out _) || inst.MatchStFld(out target, out _, out _) || inst.MatchLdFlda(out target, out _))
     {
         return(IsMethodCallOnVariable(target, variable));
     }
     return(false);
 }