Example #1
0
        public NamedStorage TryResolve(ScopedIdentifierExpr sexpr)
        {
            NamedStorage variable;
            var          name = sexpr.StartToken.Text;

            if (!scope.TryGetVariable(name, out variable))
            {
                return(null);
            }
            return(variable);
        }
Example #2
0
            public bool TryGetVariable(string name, out NamedStorage variable)
            {
                // Do we have it?
                if (Variables.TryGetValue(name, out variable))
                {
                    return(true);
                }

                // Search the parent scope:
                if (Parent != null)
                {
                    return(Parent.TryGetVariable(name, out variable));
                }

                // Not found:
                return(false);
            }