规范18.2.1.1章:
Runtime Semantics: PerformEval ( x, evalRealm, strictCaller, direct )
...
12.NOTE: If direct is true, ctx will be the execution context that performed the direct eval. If direct is false, ctx will be the execution context for the invocation of the eval function.
13.If direct is true, then
Let lexEnv be NewDeclarativeEnvironment(ctx's LexicalEnvironment).
Let varEnv be ctx's VariableEnvironment.
14.Else,
Let lexEnv be NewDeclarativeEnvironment(evalRealm.[[GlobalEnv]]).
Let varEnv be evalRealm.[[GlobalEnv]].
15.If strictEval is true, set varEnv to lexEnv.
...
展开