public void Visit(FunctionCallStmt funcCallStmt, object[] args) { FormalScope formalScope = new FormalScope(); foreach (KeyValuePair<string, Expr.Expression> actual in funcCallStmt.ParamMap) { Expr.RightValue rightValue = exprProcessor.Eval(actual.Value); formalScope.SetValue(actual.Key, rightValue); } kernel.RuntimeData.ScopeStack.Open(formalScope); kernel.RuntimeData.ScopeStack.Open(new LocalScope()); kernel.RuntimeData.InstructionStack.Push(InstructionStack.CALL_FLAG); kernel.RuntimeData.InstructionStack.Push(InstructionStack.CLOSE_LOCAL_SCOPE_FLAG); kernel.RuntimeData.InstructionStack.Push(InstructionStack.CLOSE_FORMAL_SCOPE_FLAG); kernel.RuntimeData.InstructionStack.Push(root.FuncDefMap[funcCallStmt.Name].FuncDefContent); CallStackElement elem = new CallStackElement(); elem.Destination = root.FuncDefMap[funcCallStmt.Name]; elem.Location = funcCallStmt.Location; elem.ReturnDest = exprProcessor.GetVarName(funcCallStmt.ReturnDest); kernel.RuntimeData.CallStack.Push(elem); kernel.Next(); }
public void Visit(FunctionCallStmt funcCallStmt, object[] args) { FormalScope formalScope = new FormalScope(); foreach (KeyValuePair <string, Expr.Expression> actual in funcCallStmt.ParamMap) { Expr.RightValue rightValue = exprProcessor.Eval(actual.Value); formalScope.SetValue(actual.Key, rightValue); } kernel.RuntimeData.ScopeStack.Open(formalScope); kernel.RuntimeData.ScopeStack.Open(new LocalScope()); kernel.RuntimeData.InstructionStack.Push(InstructionStack.CALL_FLAG); kernel.RuntimeData.InstructionStack.Push(InstructionStack.CLOSE_LOCAL_SCOPE_FLAG); kernel.RuntimeData.InstructionStack.Push(InstructionStack.CLOSE_FORMAL_SCOPE_FLAG); kernel.RuntimeData.InstructionStack.Push(root.FuncDefMap[funcCallStmt.Name].FuncDefContent); CallStackElement elem = new CallStackElement(); elem.Destination = root.FuncDefMap[funcCallStmt.Name]; elem.Location = funcCallStmt.Location; elem.ReturnDest = exprProcessor.GetVarName(funcCallStmt.ReturnDest); kernel.RuntimeData.CallStack.Push(elem); kernel.Next(); }