public object GetCustomMember(CodeContext context, string name) { object value; if (Scope.TryGetName(context.LanguageContext, SymbolTable.StringToId(name), out value)) { if (value != Uninitialized.Instance) { return(value); } } return(null); }
/// <summary> /// Attempts to lookup the provided name in this scope or any outer scope. Lookup /// includes searching for names that are only visible to the provided LanguageContext. /// </summary> public bool TryLookupName(LanguageContext context, SymbolId name, out object value) { Scope curScope = this; do { if (curScope == this || curScope.IsVisible) { if (curScope.TryGetName(context, name, out value)) { return(true); } } curScope = curScope.Parent; } while (curScope != null); value = null; return(false); }
/// <summary> /// Trys to lookup the provided name in the current scope. /// </summary> public bool TryGetVariable(string name, out object value) { return(_scope.TryGetName(InvariantContext.Instance, SymbolTable.StringToId(name), out value)); }