// return true if an argument exists as a param or variable internal Nullable <bool> ParamOrVariableExists(string paramOrVariable) { // do not check the snippet if (CompilableType.IsViewOrSnippet()) { return(null); } // check params bool exists = ParamExists(paramOrVariable); if (exists) { return(true); } // check variables exists = VariableExists(paramOrVariable) == true; if (exists) { return(true); } // neither param nor variable return(false); }
// general lookup method for checking the variable existence // returns: // true : it exists // false: not exists // null : check not needed (it is a snippet) internal Nullable <bool> VariableExists(string variable) { // do not check the snippet neither the view if (CompilableType.IsViewOrSnippet()) { return(null); } return(_variables.Where(v => v.Name.EqualsCS(variable)).Any()); }