From d68cd0afe236d9ad426d8d9e4a21e8f701c68f4c Mon Sep 17 00:00:00 2001 From: Robert Krimen Date: Wed, 27 Feb 2013 21:41:53 -0800 Subject: [PATCH] Establish eval execution context with the global object --- runtime.go | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/runtime.go b/runtime.go index 059e614..135bca8 100644 --- a/runtime.go +++ b/runtime.go @@ -83,7 +83,8 @@ func (self *_runtime) EnterEvalExecutionContext(call FunctionCall) { // to eval (the global execution context). Instead, execute in the context of where the eval was called, // which is essentially dynamic scoping parent := self._executionContext(-1) - new := newExecutionContext(parent.LexicalEnvironment, parent.VariableEnvironment, nil) + new := newExecutionContext(parent.LexicalEnvironment, parent.VariableEnvironment, self.GlobalObject) + // FIXME Make passing through of self.GlobalObject more general? Whenever newExecutionContext is passed a nil object? new.eval = true self.EnterExecutionContext(new) }