1
0
mirror of https://github.com/robertkrimen/otto synced 2025-10-12 20:27:30 +08:00

Establish eval execution context with the global object

This commit is contained in:
Robert Krimen 2013-02-27 21:41:53 -08:00
parent 16a30ee951
commit d68cd0afe2

View File

@ -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)
}