public CanCauseError <IExpression <T> > GetSymbolValue(string symbol)
        {
            IExpression <T> result;

            if (definedSymbols.TryGetValue(symbol, out result))
            {
                return(CanCauseError <IExpression <T> > .NoError(result));
            }

            if (ParentScope != null)
            {
                return(ParentScope.GetSymbolValue(symbol));
            }

            return(CanCauseError <IExpression <T> > .Error("Symbol {0} not defined", symbol));
        }
Exemple #2
0
        public CanCauseError <IExpression <T> > GetSymbolValue(string symbol)
        {
            IExpression <T> value;

            if (definedSymbols.TryGetValue(symbol, out value))
            {
                return(CanCauseError <IExpression <T> > .NoError(value));
            }
            else if (ParentScope != null)
            {
                return(ParentScope.GetSymbolValue(symbol));
            }
            else
            {
                return(CanCauseError <IExpression <T> > .Error("Symbol {0} not defined", symbol));
            }
        }