示例#1
0
 public Completion Evaluate(Interpreter interpreter)
 {
     if (statementList == null)
     {
         return(Completion.NormalCompletion());
     }
     return(statementList.Evaluate(interpreter));
 }
示例#2
0
        public override Completion Evaluate(Interpreter interpreter)
        {
            if (!statementList.Any())
            {
                return(Completion.NormalCompletion());
            }
            var oldEnv   = interpreter.RunningExecutionContext().LexicalEnvironment;
            var blockEnv = oldEnv.NewDeclarativeEnvironment();

            BlockDeclarationInstantiation(statementList, blockEnv);
            interpreter.RunningExecutionContext().LexicalEnvironment = blockEnv;
            Completion blockValue = statementList.Evaluate(interpreter);

            interpreter.RunningExecutionContext().LexicalEnvironment = oldEnv;
            return(blockValue);
        }