def visit(self, node): fundef = self.functions.getFunction(node.ident) args = node.args memory = Memory("funcall") for def_arg, passed_arg in zip(fundef.args, args): memory.put(def_arg.ident, self.eval_or_get_from_memory(passed_arg)) previous_stack = self.memoryStack self.memoryStack = self.functions.getStack(node.ident, memory) try: fundef.instr.accept_interpreter(self) except ReturnException as ret: self.memoryStack = previous_stack return ret.value self.memoryStack = previous_stack
def visit(self, node): memory = Memory("arguments of " + node.ident) for arg in node.args: memory.put(arg.ident, None) self.functions.putFunction(node.ident, memory, node)