コード例 #1
0
 /// <summary>
 /// Find and return parameters' VariableInfo by the given NameUse        
 /// </summary>
 /// <param name="vb"></param>
 /// <returns></returns>
 private VariableInfo FindParaVarInfo(NameUse vb)
 {
     if(vb == null) {
         return null;
     }
     var decl = vb.FindMatches().FirstOrDefault() as VariableDeclaration;
     if(decl != null) {
         foreach(var varInfo in ParametersInfo) {
             if(varInfo.Variable.Equals(decl)) {
                 return varInfo;
             }
         }
     }
     return null;
 }
コード例 #2
0
 /// <summary>
 /// Find field varible declaration for the given variable (return null if it's a local variable)
 /// </summary>
 /// <param name="vb"></param>
 /// <returns></returns>
 private VariableDeclaration FindFieldVarDecl(NameUse vb)
 {
     if(vb == null) {
         return null;
     }
     var decl = vb.FindMatches().FirstOrDefault() as VariableDeclaration;
     if(decl != null) {
         //if did not find in the current list, but method is matching
         MethodDefinition md = decl.ParentStatement.GetAncestorsAndSelf<MethodDefinition>().FirstOrDefault();
         if(md == null || !Method.Equals(md)) {
             return decl;
         }
     }
     return null;
 }