public virtual void Visit(ReturnStmt returnStmt, object[] args)
 {
 }
Beispiel #2
0
 public virtual void Visit(ReturnStmt returnStmt, object[] args)
 {
 }
        public void Visit(ReturnStmt returnStmt, object[] args)
        {
            RightValue returnValue = exprProcessor.Eval(returnStmt.Expression);
            int id;
            do
            {
                id = kernel.RuntimeData.InstructionStack.Pop();
                if (id == InstructionStack.CLOSE_LOCAL_SCOPE_FLAG)
                {
                    kernel.RuntimeData.ScopeStack.Close();
                }
                else if (id == InstructionStack.CLOSE_FORMAL_SCOPE_FLAG)
                {
                    kernel.RuntimeData.ScopeStack.Close();
                }
                else if (id == InstructionStack.CALL_FLAG)
                {
                    CallStackElement elem = kernel.RuntimeData.CallStack.Pop();
                    if (elem.ReturnDest != null)
                    {
                        kernel.RuntimeData.ScopeStack.SetValue(elem.ReturnDest, returnValue);
                    }
                }
            } while (id != InstructionStack.CALL_FLAG);

            kernel.Next();
        }