public LocalVariable ResolveVariable(string /*!*/ name) { LexicalScope scope = this; do { LocalVariable result; if (scope.TryGetValue(name, out result)) { return(result); } scope = scope.OuterScope; } while (scope != null); return(null); }
/// <summary> /// Looks the scope chain for a variable of a given name. /// Includes runtime scope in the lookup if available. /// </summary> public LocalVariable ResolveVariable(string /*!*/ name) { LexicalScope scope = this; while (true) { LocalVariable result; if (scope.TryGetValue(name, out result)) { return(result); } if (scope.IsTop) { break; } scope = scope.OuterScope; } return(null); }