コード例 #1
0
ファイル: ScriptModule.cs プロジェクト: tylike/IronScheme
        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);
        }
コード例 #2
0
ファイル: Scope.cs プロジェクト: JamesTryand/IronScheme
        /// <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);
        }
コード例 #3
0
ファイル: ScriptModule.cs プロジェクト: tylike/IronScheme
 /// <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));
 }