From 8e0a287694440908d5657118c073a0078b83549f Mon Sep 17 00:00:00 2001 From: Michael Dyck Date: Tue, 8 Dec 2020 01:22:55 -0500 Subject: [PATCH 1/7] Editorial: Model execution context as a record Resolves the first comment in issue #1742 --- spec.html | 450 +++++++++++++++++++++++++++++------------------------- 1 file changed, 241 insertions(+), 209 deletions(-) diff --git a/spec.html b/spec.html index 31b05e8afe..1414fb0aae 100644 --- a/spec.html +++ b/spec.html @@ -4427,7 +4427,7 @@

- 1. Let _privateEnv_ be the running execution context's PrivateEnvironment. + 1. Let _privateEnv_ be the running execution context's [[PrivateEnvironment]]. 1. Assert: _privateEnv_ is not *null*. 1. Let _privateName_ be ResolvePrivateIdentifier(_privateEnv_, _privateIdentifier_). 1. Return the Reference Record { [[Base]]: _baseValue_, [[ReferencedName]]: _privateName_, [[Strict]]: *true*, [[ThisValue]]: ~empty~ }. @@ -11785,10 +11785,10 @@

InitializeHostDefinedRealm ( ): either a normal completion containing ~unuse 1. Set _realm_.[[GlobalObject]] to *undefined*. 1. Set _realm_.[[GlobalEnv]] to *undefined*. 1. Set _realm_.[[TemplateMap]] to a new empty List. - 1. Let _newContext_ be a new execution context. - 1. Set the Function of _newContext_ to *null*. - 1. Set the Realm of _newContext_ to _realm_. - 1. Set the ScriptOrModule of _newContext_ to *null*. + 1. Let _newContext_ be a new ExecutionContext Record. + 1. Set _newContext_.[[Function]] to *null*. + 1. Set _newContext_.[[Realm]] to _realm_. + 1. Set _newContext_.[[ScriptOrModule]] to *null*. 1. Push _newContext_ onto the execution context stack; _newContext_ is now the running execution context. 1. If the host requires use of an exotic object to serve as _realm_'s global object, then 1. Let _global_ be such an object created in a host-defined manner. @@ -11845,22 +11845,28 @@

Execution Contexts

An execution context is a specification device that is used to track the runtime evaluation of code by an ECMAScript implementation. At any point in time, there is at most one execution context per agent that is actually executing code. This is known as the agent's running execution context. All references to the running execution context in this specification denote the running execution context of the surrounding agent.

The execution context stack is used to track execution contexts. The running execution context is always the top element of this stack. A new execution context is created whenever control is transferred from the executable code associated with the currently running execution context to executable code that is not associated with that execution context. The newly created execution context is pushed onto the stack and becomes the running execution context.

-

An execution context contains whatever implementation specific state is necessary to track the execution progress of its associated code. Each execution context has at least the state components listed in .

- +

Each execution context is represented as an ExecutionContext Record, with at least the fields listed in .

+ + + + + +
- Component + Field Name - Purpose + Value Type + + Meaning
- code evaluation state + [[CodeEvaluationState]] + + implementation-specific Any state needed to perform, suspend, and resume evaluation of the code associated with this execution context. @@ -11868,15 +11874,21 @@

Execution Contexts

- Function + [[Function]] - If this execution context is evaluating the code of a function object, then the value of this component is that function object. If the context is evaluating the code of a |Script| or |Module|, the value is *null*. + a function object or *null* + + If this execution context is evaluating the code of a function object, then the value of this field is that function object. If the context is evaluating the code of a |Script| or |Module|, the value is *null*.
- Realm + [[Realm]] + + a Realm Record The Realm Record from which associated code accesses ECMAScript resources. @@ -11884,7 +11896,10 @@

Execution Contexts

- ScriptOrModule + [[ScriptOrModule]] + + a Module Record, a Script Record, or *null* The Module Record or Script Record from which associated code originates. If there is no originating script or module, as is the case for the original execution context created in InitializeHostDefinedRealm, the value is *null*. @@ -11893,23 +11908,29 @@

Execution Contexts

Evaluation of code by the running execution context may be suspended at various points defined within this specification. Once the running execution context has been suspended a different execution context may become the running execution context and commence evaluating its code. At some later time a suspended execution context may again become the running execution context and continue evaluating its code at the point where it had previously been suspended. Transition of the running execution context status among execution contexts usually occurs in stack-like last-in/first-out manner. However, some ECMAScript features require non-LIFO transitions of the running execution context.

-

The value of the Realm component of the running execution context is also called the current Realm Record. The value of the Function component of the running execution context is also called the active function object.

-

ECMAScript code execution contexts have the additional state components listed in .

- +

The value of the running execution context's [[Realm]] field is also called the current Realm Record. The value of the running execution context's [[Function]] field is also called the active function object.

+

ECMAScript code execution contexts have the additional fields listed in .

+ + + + +
- Component + Field Name - Purpose + Value Type + + Meaning
- LexicalEnvironment + [[LexicalEnvironment]] + + an Environment Record Identifies the Environment Record used to resolve identifier references made by code within this execution context. @@ -11917,7 +11938,10 @@

Execution Contexts

- VariableEnvironment + [[VariableEnvironment]] + + an Environment Record Identifies the Environment Record that holds bindings created by |VariableStatement|s within this execution context. @@ -11925,7 +11949,10 @@

Execution Contexts

- PrivateEnvironment + [[PrivateEnvironment]] + + a PrivateEnvironment Record or *null* Identifies the PrivateEnvironment Record that holds Private Names created by |ClassElement|s in the nearest containing class. *null* if there is no containing class. @@ -11933,23 +11960,28 @@

Execution Contexts

-

The LexicalEnvironment and VariableEnvironment components of an execution context are always Environment Records.

-

Execution contexts representing the evaluation of Generators have the additional state components listed in .

- +

ExecutionContext Records representing the evaluation of Generators have the additional fields listed in .

+ + +
- Component + Field Name - Purpose + Value Type + + Meaning
- Generator + [[Generator]] + + an Object The Generator that this execution context is evaluating. @@ -11957,7 +11989,7 @@

Execution Contexts

-

In most situations only the running execution context (the top of the execution context stack) is directly manipulated by algorithms within this specification. Hence when the terms “LexicalEnvironment”, and “VariableEnvironment” are used without qualification they are in reference to those components of the running execution context.

+

In most situations only the running execution context (the top of the execution context stack) is directly manipulated by algorithms within this specification.

An execution context is purely a specification mechanism and need not correspond to any particular artefact of an ECMAScript implementation. It is impossible for ECMAScript code to directly access or observe an execution context.

@@ -11969,8 +12001,8 @@

GetActiveScriptOrModule ( ): a Script Record, a Module Record, or *null*

1. If the execution context stack is empty, return *null*. - 1. Let _ec_ be the topmost execution context on the execution context stack whose ScriptOrModule component is not *null*. - 1. If no such execution context exists, return *null*. Otherwise, return _ec_'s ScriptOrModule. + 1. Let _ec_ be the topmost execution context on the execution context stack whose [[ScriptOrModule]] field is not *null*. + 1. If no such execution context exists, return *null*. Otherwise, return _ec_.[[ScriptOrModule]].
@@ -11987,7 +12019,7 @@

1. If _env_ is not present or _env_ is *undefined*, then - 1. Set _env_ to the running execution context's LexicalEnvironment. + 1. Set _env_ to the running execution context's [[LexicalEnvironment]]. 1. Assert: _env_ is an Environment Record. 1. Let _strict_ be IsStrict(the syntactic production that is being evaluated). 1. Return ? GetIdentifierReference(_env_, _name_, _strict_). @@ -12004,7 +12036,7 @@

GetThisEnvironment ( ): an Environment Record

It finds the Environment Record that currently supplies the binding of the keyword `this`.
- 1. Let _env_ be the running execution context's LexicalEnvironment. + 1. Let _env_ be the running execution context's [[LexicalEnvironment]]. 1. [id="step-getthisenvironment-loop"] Repeat, 1. Let _exists_ be _env_.HasThisBinding(). 1. If _exists_ is *true*, return _env_. @@ -12021,7 +12053,7 @@

GetThisEnvironment ( ): an Environment Record

ResolveThisBinding ( ): either a normal completion containing an ECMAScript language value or a throw completion

description
-
It determines the binding of the keyword `this` using the LexicalEnvironment of the running execution context.
+
It determines the binding of the keyword `this` using the running execution context's [[LexicalEnvironment]].
1. Let _envRec_ be GetThisEnvironment(). @@ -12033,7 +12065,7 @@

ResolveThisBinding ( ): either a normal completion containing an ECMAScript

GetNewTarget ( ): an Object or *undefined*

description
-
It determines the NewTarget value using the LexicalEnvironment of the running execution context.
+
It determines the NewTarget value using the running execution context's [[LexicalEnvironment]].
1. Let _envRec_ be GetThisEnvironment(). @@ -12080,13 +12112,13 @@

Jobs and Host Operations to Enqueue Jobs

At any particular time, _scriptOrModule_ (a Script Record, a Module Record, or *null*) is the active script or module if all of the following conditions are true:

  • GetActiveScriptOrModule() is _scriptOrModule_.
  • -
  • If _scriptOrModule_ is a Script Record or Module Record, let _ec_ be the topmost execution context on the execution context stack whose ScriptOrModule component is _scriptOrModule_. The Realm component of _ec_ is _scriptOrModule_.[[Realm]].
  • +
  • If _scriptOrModule_ is a Script Record or Module Record, let _ec_ be the topmost execution context on the execution context stack whose [[ScriptOrModule]] field is _scriptOrModule_. _ec_.[[Realm]] is _scriptOrModule_.[[Realm]].

At any particular time, an execution is prepared to evaluate ECMAScript code if all of the following conditions are true:

  • The execution context stack is not empty.
  • -
  • The Realm component of the topmost execution context on the execution context stack is a Realm Record.
  • +
  • The [[Realm]] field of the topmost execution context on the execution context stack is a Realm Record.
@@ -13421,15 +13453,15 @@

1. Let _callerContext_ be the running execution context. - 1. Let _calleeContext_ be a new ECMAScript code execution context. - 1. Set the Function of _calleeContext_ to _F_. + 1. Let _calleeContext_ be a new ECMAScript code ExecutionContext Record. + 1. Set _calleeContext_.[[Function]] to _F_. 1. Let _calleeRealm_ be _F_.[[Realm]]. - 1. Set the Realm of _calleeContext_ to _calleeRealm_. - 1. Set the ScriptOrModule of _calleeContext_ to _F_.[[ScriptOrModule]]. + 1. Set _calleeContext_.[[Realm]] to _calleeRealm_. + 1. Set _calleeContext_.[[ScriptOrModule]] to _F_.[[ScriptOrModule]]. 1. Let _localEnv_ be NewFunctionEnvironment(_F_, _newTarget_). - 1. Set the LexicalEnvironment of _calleeContext_ to _localEnv_. - 1. Set the VariableEnvironment of _calleeContext_ to _localEnv_. - 1. Set the PrivateEnvironment of _calleeContext_ to _F_.[[PrivateEnvironment]]. + 1. Set _calleeContext_.[[LexicalEnvironment]] to _localEnv_. + 1. Set _calleeContext_.[[VariableEnvironment]] to _localEnv_. + 1. Set _calleeContext_.[[PrivateEnvironment]] to _F_.[[PrivateEnvironment]]. 1. If _callerContext_ is not already suspended, suspend _callerContext_. 1. Push _calleeContext_ onto the execution context stack; _calleeContext_ is now the running execution context. 1. NOTE: Any exception objects produced after this point are associated with _calleeRealm_. @@ -13451,7 +13483,7 @@

1. Let _thisMode_ be _F_.[[ThisMode]]. 1. If _thisMode_ is ~lexical~, return ~unused~. 1. Let _calleeRealm_ be _F_.[[Realm]]. - 1. Let _localEnv_ be the LexicalEnvironment of _calleeContext_. + 1. Let _localEnv_ be _calleeContext_.[[LexicalEnvironment]]. 1. If _thisMode_ is ~strict~, then 1. Let _thisValue_ be _thisArgument_. 1. Else, @@ -13573,7 +13605,7 @@

1. If _initializeResult_ is an abrupt completion, then 1. Remove _calleeContext_ from the execution context stack and restore _callerContext_ as the running execution context. 1. Return ? _initializeResult_. - 1. Let _constructorEnv_ be the LexicalEnvironment of _calleeContext_. + 1. Let _constructorEnv_ be _calleeContext_.[[LexicalEnvironment]]. 1. Let _result_ be Completion(OrdinaryCallEvaluateBody(_F_, _argumentsList_)). 1. Remove _calleeContext_ from the execution context stack and restore _callerContext_ as the running execution context. 1. If _result_ is a return completion, then @@ -13849,13 +13881,13 @@

1. Set _argumentsObjectNeeded_ to *false*. 1. If _strict_ is *true* or _hasParameterExpressions_ is *false*, then 1. NOTE: Only a single Environment Record is needed for the parameters, since calls to `eval` in strict mode code cannot create new bindings which are visible outside of the `eval`. - 1. Let _env_ be the LexicalEnvironment of _calleeContext_. + 1. Let _env_ be _calleeContext_.[[LexicalEnvironment]]. 1. Else, 1. NOTE: A separate Environment Record is needed to ensure that bindings created by direct eval calls in the formal parameter list are outside the environment where parameters are declared. - 1. Let _calleeEnv_ be the LexicalEnvironment of _calleeContext_. + 1. Let _calleeEnv_ be _calleeContext_.[[LexicalEnvironment]]. 1. Let _env_ be NewDeclarativeEnvironment(_calleeEnv_). - 1. Assert: The VariableEnvironment of _calleeContext_ and _calleeEnv_ are the same Environment Record. - 1. Set the LexicalEnvironment of _calleeContext_ to _env_. + 1. Assert: _calleeContext_.[[VariableEnvironment]] and _calleeEnv_ are the same Environment Record. + 1. Set _calleeContext_.[[LexicalEnvironment]] to _env_. 1. For each String _paramName_ of _parameterNames_, do 1. Let _alreadyDeclared_ be ! _env_.HasBinding(_paramName_). 1. NOTE: Early errors ensure that duplicate parameter names can only occur in non-strict functions that do not have parameter default values or rest parameters. @@ -13895,7 +13927,7 @@

1. Else, 1. NOTE: A separate Environment Record is needed to ensure that closures created by expressions in the formal parameter list do not have visibility of declarations in the function body. 1. Let _varEnv_ be NewDeclarativeEnvironment(_env_). - 1. Set the VariableEnvironment of _calleeContext_ to _varEnv_. + 1. Set _calleeContext_.[[VariableEnvironment]] to _varEnv_. 1. Let _instantiatedVarNames_ be a new empty List. 1. For each element _n_ of _varNames_, do 1. If _instantiatedVarNames_ does not contain _n_, then @@ -13913,7 +13945,7 @@

1. NOTE: Non-strict functions use a separate Environment Record for top-level lexical declarations so that a direct eval can determine whether any var scoped declarations introduced by the eval code conflict with pre-existing top-level lexically scoped declarations. This is not needed for strict functions because a strict direct eval always places all declarations into a new Environment Record. 1. Else, 1. Let _lexEnv_ be _varEnv_. - 1. Set the LexicalEnvironment of _calleeContext_ to _lexEnv_. + 1. Set _calleeContext_.[[LexicalEnvironment]] to _lexEnv_. 1. Let _lexDeclarations_ be the LexicallyScopedDeclarations of _code_. 1. For each element _d_ of _lexDeclarations_, do 1. NOTE: A lexically declared name cannot be the same as a function/generator declaration, formal parameter, or a var name. Lexically declared names are only instantiated here but not initialized. @@ -13922,7 +13954,7 @@

1. Perform ! _lexEnv_.CreateImmutableBinding(_dn_, *true*). 1. Else, 1. Perform ! _lexEnv_.CreateMutableBinding(_dn_, *false*). - 1. Let _privateEnv_ be the PrivateEnvironment of _calleeContext_. + 1. Let _privateEnv_ be _calleeContext_.[[PrivateEnvironment]]. 1. For each Parse Node _f_ of _functionsToInitialize_, do 1. Let _fn_ be the sole element of the BoundNames of _f_. 1. Let _fo_ be InstantiateFunctionObject of _f_ with arguments _lexEnv_ and _privateEnv_. @@ -13994,11 +14026,11 @@

1. Let _callerContext_ be the running execution context. 1. If _callerContext_ is not already suspended, suspend _callerContext_. - 1. Let _calleeContext_ be a new execution context. - 1. Set the Function of _calleeContext_ to _F_. + 1. Let _calleeContext_ be a new ExecutionContext Record. + 1. Set _calleeContext_.[[Function]] to _F_. 1. Let _calleeRealm_ be _F_.[[Realm]]. - 1. Set the Realm of _calleeContext_ to _calleeRealm_. - 1. Set the ScriptOrModule of _calleeContext_ to *null*. + 1. Set _calleeContext_.[[Realm]] to _calleeRealm_. + 1. Set _calleeContext_.[[ScriptOrModule]] to *null*. 1. Perform any necessary implementation-defined initialization of _calleeContext_. 1. Push _calleeContext_ onto the execution context stack; _calleeContext_ is now the running execution context. 1. [id="step-call-builtin-function-result"] Let _result_ be the Completion Record that is the result of evaluating _F_ in a manner that conforms to the specification of _F_. If _thisArgument_ is ~uninitialized~, the *this* value is uninitialized; otherwise, _thisArgument_ provides the *this* value. _argumentsList_ provides the named parameters. _newTarget_ provides the NewTarget value. @@ -20369,7 +20401,7 @@

Runtime Semantics: Evaluation

1. Let _rRef_ be ? Evaluation of |ShiftExpression|. 1. Let _rVal_ be ? GetValue(_rRef_). 1. If _rVal_ is not an Object, throw a *TypeError* exception. - 1. Let _privateEnv_ be the running execution context's PrivateEnvironment. + 1. Let _privateEnv_ be the running execution context's [[PrivateEnvironment]]. 1. Let _privateName_ be ResolvePrivateIdentifier(_privateEnv_, _privateIdentifier_). 1. If PrivateElementFind(_rVal_, _privateName_) is not ~empty~, return *true*. 1. Return *false*. @@ -21328,16 +21360,16 @@

Runtime Semantics: Evaluation

Block : `{` StatementList `}` - 1. Let _oldEnv_ be the running execution context's LexicalEnvironment. + 1. Let _oldEnv_ be the running execution context's [[LexicalEnvironment]]. 1. Let _blockEnv_ be NewDeclarativeEnvironment(_oldEnv_). 1. Perform BlockDeclarationInstantiation(|StatementList|, _blockEnv_). - 1. Set the running execution context's LexicalEnvironment to _blockEnv_. + 1. Set the running execution context's [[LexicalEnvironment]] to _blockEnv_. 1. Let _blockValue_ be Completion(Evaluation of |StatementList|). - 1. Set the running execution context's LexicalEnvironment to _oldEnv_. + 1. Set the running execution context's [[LexicalEnvironment]] to _oldEnv_. 1. Return ? _blockValue_. -

No matter how control leaves the |Block| the LexicalEnvironment is always restored to its former state.

+

No matter how control leaves the |Block| the [[LexicalEnvironment]] is always restored to its former state.

StatementList : StatementList StatementListItem @@ -21377,7 +21409,7 @@

--> 1. Let _declarations_ be the LexicallyScopedDeclarations of _code_. - 1. Let _privateEnv_ be the running execution context's PrivateEnvironment. + 1. Let _privateEnv_ be the running execution context's [[PrivateEnvironment]]. 1. For each element _d_ of _declarations_, do 1. For each element _dn_ of the BoundNames of _d_, do 1. If IsConstantDeclaration of _d_ is *true*, then @@ -21399,7 +21431,7 @@

Declarations and the Variable Statement

Let and Const Declarations

-

`let` and `const` declarations define variables that are scoped to the running execution context's LexicalEnvironment. The variables are created when their containing Environment Record is instantiated but may not be accessed in any way until the variable's |LexicalBinding| is evaluated. A variable defined by a |LexicalBinding| with an |Initializer| is assigned the value of its |Initializer|'s |AssignmentExpression| when the |LexicalBinding| is evaluated, not when the variable is created. If a |LexicalBinding| in a `let` declaration does not have an |Initializer| the variable is assigned the value *undefined* when the |LexicalBinding| is evaluated.

+

`let` and `const` declarations define variables that are scoped to the running execution context's [[LexicalEnvironment]]. The variables are created when their containing Environment Record is instantiated but may not be accessed in any way until the variable's |LexicalBinding| is evaluated. A variable defined by a |LexicalBinding| with an |Initializer| is assigned the value of its |Initializer|'s |AssignmentExpression| when the |LexicalBinding| is evaluated, not when the variable is created. If a |LexicalBinding| in a `let` declaration does not have an |Initializer| the variable is assigned the value *undefined* when the |LexicalBinding| is evaluated.

Syntax

@@ -21475,7 +21507,7 @@

Runtime Semantics: Evaluation

1. Let _rhs_ be ? Evaluation of |Initializer|. 1. Let _value_ be ? GetValue(_rhs_). - 1. Let _env_ be the running execution context's LexicalEnvironment. + 1. Let _env_ be the running execution context's [[LexicalEnvironment]]. 1. Return ? BindingInitialization of |BindingPattern| with arguments _value_ and _env_.
@@ -21484,7 +21516,7 @@

Runtime Semantics: Evaluation

Variable Statement

-

A `var` statement declares variables that are scoped to the running execution context's VariableEnvironment. Var variables are created when their containing Environment Record is instantiated and are initialized to *undefined* when created. Within the scope of any VariableEnvironment a common |BindingIdentifier| may appear in more than one |VariableDeclaration| but those declarations collectively define only one variable. A variable defined by a |VariableDeclaration| with an |Initializer| is assigned the value of its |Initializer|'s |AssignmentExpression| when the |VariableDeclaration| is executed, not when the variable is created.

+

A `var` statement declares variables that are scoped to the running execution context's [[VariableEnvironment]]. Var variables are created when their containing Environment Record is instantiated and are initialized to *undefined* when created. Within the scope of any [[VariableEnvironment]] a common |BindingIdentifier| may appear in more than one |VariableDeclaration| but those declarations collectively define only one variable. A variable defined by a |VariableDeclaration| with an |Initializer| is assigned the value of its |Initializer|'s |AssignmentExpression| when the |VariableDeclaration| is executed, not when the variable is created.

Syntax

@@ -21529,7 +21561,7 @@

Runtime Semantics: Evaluation

1. Return ~empty~.
-

If a |VariableDeclaration| is nested within a with statement and the |BindingIdentifier| in the |VariableDeclaration| is the same as a property name of the binding object of the with statement's Object Environment Record, then step will assign _value_ to the property instead of assigning to the VariableEnvironment binding of the |Identifier|.

+

If a |VariableDeclaration| is nested within a with statement and the |BindingIdentifier| in the |VariableDeclaration| is the same as a property name of the binding object of the with statement's Object Environment Record, then step will assign _value_ to the property instead of assigning to the [[VariableEnvironment]] binding of the |Identifier|.

VariableDeclaration : BindingPattern Initializer @@ -21984,7 +22016,7 @@

ForStatement : `for` `(` LexicalDeclaration Expression? `;` Expression? `)` Statement - 1. Let _oldEnv_ be the running execution context's LexicalEnvironment. + 1. Let _oldEnv_ be the running execution context's [[LexicalEnvironment]]. 1. Let _loopEnv_ be NewDeclarativeEnvironment(_oldEnv_). 1. Let _isConst_ be IsConstantDeclaration of |LexicalDeclaration|. 1. Let _boundNames_ be the BoundNames of |LexicalDeclaration|. @@ -21993,16 +22025,16 @@

1. Perform ! _loopEnv_.CreateImmutableBinding(_dn_, *true*). 1. Else, 1. Perform ! _loopEnv_.CreateMutableBinding(_dn_, *false*). - 1. Set the running execution context's LexicalEnvironment to _loopEnv_. + 1. Set the running execution context's [[LexicalEnvironment]] to _loopEnv_. 1. Let _forDcl_ be Completion(Evaluation of |LexicalDeclaration|). 1. If _forDcl_ is an abrupt completion, then - 1. Set the running execution context's LexicalEnvironment to _oldEnv_. + 1. Set the running execution context's [[LexicalEnvironment]] to _oldEnv_. 1. Return ? _forDcl_. 1. If _isConst_ is *false*, let _perIterationLets_ be _boundNames_; otherwise let _perIterationLets_ be a new empty List. 1. If the first |Expression| is present, let _test_ be the first |Expression|; otherwise, let _test_ be ~empty~. 1. If the second |Expression| is present, let _increment_ be the second |Expression|; otherwise, let _increment_ be ~empty~. 1. Let _bodyResult_ be Completion(ForBodyEvaluation(_test_, _increment_, |Statement|, _perIterationLets_, _labelSet_)). - 1. Set the running execution context's LexicalEnvironment to _oldEnv_. + 1. Set the running execution context's [[LexicalEnvironment]] to _oldEnv_. 1. Return ? _bodyResult_. @@ -22047,7 +22079,7 @@

1. If _perIterationBindings_ has any elements, then - 1. Let _lastIterationEnv_ be the running execution context's LexicalEnvironment. + 1. Let _lastIterationEnv_ be the running execution context's [[LexicalEnvironment]]. 1. Let _outer_ be _lastIterationEnv_.[[OuterEnv]]. 1. Assert: _outer_ is not *null*. 1. Let _thisIterationEnv_ be NewDeclarativeEnvironment(_outer_). @@ -22055,7 +22087,7 @@

1. Perform ! _thisIterationEnv_.CreateMutableBinding(_bn_, *false*). 1. Let _lastValue_ be ? _lastIterationEnv_.GetBindingValue(_bn_, *true*). 1. Perform ! _thisIterationEnv_.InitializeBinding(_bn_, _lastValue_). - 1. Set the running execution context's LexicalEnvironment to _thisIterationEnv_. + 1. Set the running execution context's [[LexicalEnvironment]] to _thisIterationEnv_. 1. Return ~unused~. @@ -22300,15 +22332,15 @@

- 1. Let _oldEnv_ be the running execution context's LexicalEnvironment. + 1. Let _oldEnv_ be the running execution context's [[LexicalEnvironment]]. 1. If _uninitializedBoundNames_ is not empty, then 1. Assert: _uninitializedBoundNames_ has no duplicate entries. 1. Let _newEnv_ be NewDeclarativeEnvironment(_oldEnv_). 1. For each String _name_ of _uninitializedBoundNames_, do 1. Perform ! _newEnv_.CreateMutableBinding(_name_, *false*). - 1. Set the running execution context's LexicalEnvironment to _newEnv_. + 1. Set the running execution context's [[LexicalEnvironment]] to _newEnv_. 1. Let _exprRef_ be Completion(Evaluation of _expr_). - 1. Set the running execution context's LexicalEnvironment to _oldEnv_. + 1. Set the running execution context's [[LexicalEnvironment]] to _oldEnv_. 1. Let _exprValue_ be ? GetValue(? _exprRef_). 1. If _iterationKind_ is ~enumerate~, then 1. If _exprValue_ is either *undefined* or *null*, then @@ -22341,7 +22373,7 @@

1. If _iteratorKind_ is not present, set _iteratorKind_ to ~sync~. - 1. Let _oldEnv_ be the running execution context's LexicalEnvironment. + 1. Let _oldEnv_ be the running execution context's [[LexicalEnvironment]]. 1. Let _V_ be *undefined*. 1. Let _destructuring_ be IsDestructuring of _lhs_. 1. If _destructuring_ is *true* and _lhsKind_ is ~assignment~, then @@ -22373,7 +22405,7 @@

1. Assert: _lhs_ is a |ForDeclaration|. 1. Let _iterationEnv_ be NewDeclarativeEnvironment(_oldEnv_). 1. Perform ForDeclarationBindingInstantiation of _lhs_ with argument _iterationEnv_. - 1. Set the running execution context's LexicalEnvironment to _iterationEnv_. + 1. Set the running execution context's [[LexicalEnvironment]] to _iterationEnv_. 1. If _destructuring_ is *true*, then 1. Let _status_ be Completion(ForDeclarationBindingInitialization of _lhs_ with arguments _nextValue_ and _iterationEnv_). 1. Else, @@ -22382,7 +22414,7 @@

1. Let _lhsRef_ be ! ResolveBinding(_lhsName_). 1. Let _status_ be Completion(InitializeReferencedBinding(_lhsRef_, _nextValue_)). 1. If _status_ is an abrupt completion, then - 1. Set the running execution context's LexicalEnvironment to _oldEnv_. + 1. Set the running execution context's [[LexicalEnvironment]] to _oldEnv_. 1. If _iteratorKind_ is ~async~, return ? AsyncIteratorClose(_iteratorRecord_, _status_). 1. If _iterationKind_ is ~enumerate~, then 1. Return ? _status_. @@ -22390,7 +22422,7 @@

1. Assert: _iterationKind_ is ~iterate~. 1. Return ? IteratorClose(_iteratorRecord_, _status_). 1. Let _result_ be Completion(Evaluation of _stmt_). - 1. Set the running execution context's LexicalEnvironment to _oldEnv_. + 1. Set the running execution context's [[LexicalEnvironment]] to _oldEnv_. 1. If LoopContinues(_result_, _labelSet_) is *false*, then 1. If _iterationKind_ is ~enumerate~, then 1. Return ? UpdateEmpty(_result_, _V_). @@ -22734,15 +22766,15 @@

Runtime Semantics: Evaluation

1. Let _val_ be ? Evaluation of |Expression|. 1. Let _obj_ be ? ToObject(? GetValue(_val_)). - 1. Let _oldEnv_ be the running execution context's LexicalEnvironment. + 1. Let _oldEnv_ be the running execution context's [[LexicalEnvironment]]. 1. Let _newEnv_ be NewObjectEnvironment(_obj_, *true*, _oldEnv_). - 1. Set the running execution context's LexicalEnvironment to _newEnv_. + 1. Set the running execution context's [[LexicalEnvironment]] to _newEnv_. 1. Let _C_ be Completion(Evaluation of |Statement|). - 1. Set the running execution context's LexicalEnvironment to _oldEnv_. + 1. Set the running execution context's [[LexicalEnvironment]] to _oldEnv_. 1. Return ? UpdateEmpty(_C_, *undefined*). -

No matter how control leaves the embedded |Statement|, whether normally or by some form of abrupt completion or exception, the LexicalEnvironment is always restored to its former state.

+

No matter how control leaves the embedded |Statement|, whether normally or by some form of abrupt completion or exception, the [[LexicalEnvironment]] is always restored to its former state.

@@ -22877,16 +22909,16 @@

Runtime Semantics: Evaluation

1. Let _exprRef_ be ? Evaluation of |Expression|. 1. Let _switchValue_ be ? GetValue(_exprRef_). - 1. Let _oldEnv_ be the running execution context's LexicalEnvironment. + 1. Let _oldEnv_ be the running execution context's [[LexicalEnvironment]]. 1. Let _blockEnv_ be NewDeclarativeEnvironment(_oldEnv_). 1. Perform BlockDeclarationInstantiation(|CaseBlock|, _blockEnv_). - 1. Set the running execution context's LexicalEnvironment to _blockEnv_. + 1. Set the running execution context's [[LexicalEnvironment]] to _blockEnv_. 1. Let _R_ be Completion(CaseBlockEvaluation of |CaseBlock| with argument _switchValue_). - 1. Set the running execution context's LexicalEnvironment to _oldEnv_. + 1. Set the running execution context's [[LexicalEnvironment]] to _oldEnv_. 1. Return _R_. -

No matter how control leaves the |SwitchStatement| the LexicalEnvironment is always restored to its former state.

+

No matter how control leaves the |SwitchStatement| the [[LexicalEnvironment]] is always restored to its former state.

CaseClause : `case` Expression `:` @@ -23098,17 +23130,17 @@

Catch : `catch` `(` CatchParameter `)` Block - 1. Let _oldEnv_ be the running execution context's LexicalEnvironment. + 1. Let _oldEnv_ be the running execution context's [[LexicalEnvironment]]. 1. Let _catchEnv_ be NewDeclarativeEnvironment(_oldEnv_). 1. For each element _argName_ of the BoundNames of |CatchParameter|, do 1. Perform ! _catchEnv_.CreateMutableBinding(_argName_, *false*). - 1. Set the running execution context's LexicalEnvironment to _catchEnv_. + 1. Set the running execution context's [[LexicalEnvironment]] to _catchEnv_. 1. Let _status_ be Completion(BindingInitialization of |CatchParameter| with arguments _thrownValue_ and _catchEnv_). 1. If _status_ is an abrupt completion, then - 1. Set the running execution context's LexicalEnvironment to _oldEnv_. + 1. Set the running execution context's [[LexicalEnvironment]] to _oldEnv_. 1. Return ? _status_. 1. Let _B_ be Completion(Evaluation of |Block|). - 1. Set the running execution context's LexicalEnvironment to _oldEnv_. + 1. Set the running execution context's [[LexicalEnvironment]] to _oldEnv_. 1. Return ? _B_. Catch : `catch` Block @@ -23116,7 +23148,7 @@

1. Return ? Evaluation of |Block|. -

No matter how control leaves the |Block| the LexicalEnvironment is always restored to its former state.

+

No matter how control leaves the |Block| the [[LexicalEnvironment]] is always restored to its former state.

@@ -23620,8 +23652,8 @@

FunctionExpression : `function` `(` FormalParameters `)` `{` FunctionBody `}` 1. If _name_ is not present, set _name_ to *""*. - 1. Let _env_ be the LexicalEnvironment of the running execution context. - 1. Let _privateEnv_ be the running execution context's PrivateEnvironment. + 1. Let _env_ be the running execution context's [[LexicalEnvironment]]. + 1. Let _privateEnv_ be the running execution context's [[PrivateEnvironment]]. 1. Let _sourceText_ be the source text matched by |FunctionExpression|. 1. Let _closure_ be OrdinaryFunctionCreate(%Function.prototype%, _sourceText_, |FormalParameters|, |FunctionBody|, ~non-lexical-this~, _env_, _privateEnv_). 1. Perform SetFunctionName(_closure_, _name_). @@ -23632,10 +23664,10 @@

1. Assert: _name_ is not present. 1. Set _name_ to the StringValue of |BindingIdentifier|. - 1. Let _outerEnv_ be the running execution context's LexicalEnvironment. + 1. Let _outerEnv_ be the running execution context's [[LexicalEnvironment]]. 1. Let _funcEnv_ be NewDeclarativeEnvironment(_outerEnv_). 1. Perform ! _funcEnv_.CreateImmutableBinding(_name_, *false*). - 1. Let _privateEnv_ be the running execution context's PrivateEnvironment. + 1. Let _privateEnv_ be the running execution context's [[PrivateEnvironment]]. 1. Let _sourceText_ be the source text matched by |FunctionExpression|. 1. Let _closure_ be OrdinaryFunctionCreate(%Function.prototype%, _sourceText_, |FormalParameters|, |FunctionBody|, ~non-lexical-this~, _funcEnv_, _privateEnv_). 1. Perform SetFunctionName(_closure_, _name_). @@ -23772,8 +23804,8 @@

ArrowFunction : ArrowParameters `=>` ConciseBody 1. If _name_ is not present, set _name_ to *""*. - 1. Let _env_ be the LexicalEnvironment of the running execution context. - 1. Let _privateEnv_ be the running execution context's PrivateEnvironment. + 1. Let _env_ be the running execution context's [[LexicalEnvironment]]. + 1. Let _privateEnv_ be the running execution context's [[PrivateEnvironment]]. 1. Let _sourceText_ be the source text matched by |ArrowFunction|. 1. [id="step-arrowfunction-evaluation-functioncreate"] Let _closure_ be OrdinaryFunctionCreate(%Function.prototype%, _sourceText_, |ArrowParameters|, |ConciseBody|, ~lexical-this~, _env_, _privateEnv_). 1. Perform SetFunctionName(_closure_, _name_). @@ -23910,8 +23942,8 @@

MethodDefinition : ClassElementName `(` UniqueFormalParameters `)` `{` FunctionBody `}` 1. Let _propKey_ be ? Evaluation of |ClassElementName|. - 1. Let _env_ be the running execution context's LexicalEnvironment. - 1. Let _privateEnv_ be the running execution context's PrivateEnvironment. + 1. Let _env_ be the running execution context's [[LexicalEnvironment]]. + 1. Let _privateEnv_ be the running execution context's [[PrivateEnvironment]]. 1. If _functionPrototype_ is present, then 1. Let _prototype_ be _functionPrototype_. 1. Else, @@ -23941,8 +23973,8 @@

MethodDefinition : `get` ClassElementName `(` `)` `{` FunctionBody `}` 1. Let _propKey_ be ? Evaluation of |ClassElementName|. - 1. Let _env_ be the running execution context's LexicalEnvironment. - 1. Let _privateEnv_ be the running execution context's PrivateEnvironment. + 1. Let _env_ be the running execution context's [[LexicalEnvironment]]. + 1. Let _privateEnv_ be the running execution context's [[PrivateEnvironment]]. 1. Let _sourceText_ be the source text matched by |MethodDefinition|. 1. Let _formalParameterList_ be an instance of the production FormalParameters : [empty]. 1. Let _closure_ be OrdinaryFunctionCreate(%Function.prototype%, _sourceText_, _formalParameterList_, |FunctionBody|, ~non-lexical-this~, _env_, _privateEnv_). @@ -23958,8 +23990,8 @@

MethodDefinition : `set` ClassElementName `(` PropertySetParameterList `)` `{` FunctionBody `}` 1. Let _propKey_ be ? Evaluation of |ClassElementName|. - 1. Let _env_ be the running execution context's LexicalEnvironment. - 1. Let _privateEnv_ be the running execution context's PrivateEnvironment. + 1. Let _env_ be the running execution context's [[LexicalEnvironment]]. + 1. Let _privateEnv_ be the running execution context's [[PrivateEnvironment]]. 1. Let _sourceText_ be the source text matched by |MethodDefinition|. 1. Let _closure_ be OrdinaryFunctionCreate(%Function.prototype%, _sourceText_, |PropertySetParameterList|, |FunctionBody|, ~non-lexical-this~, _env_, _privateEnv_). 1. Perform MakeMethod(_closure_, _object_). @@ -23974,8 +24006,8 @@

GeneratorMethod : `*` ClassElementName `(` UniqueFormalParameters `)` `{` GeneratorBody `}` 1. Let _propKey_ be ? Evaluation of |ClassElementName|. - 1. Let _env_ be the running execution context's LexicalEnvironment. - 1. Let _privateEnv_ be the running execution context's PrivateEnvironment. + 1. Let _env_ be the running execution context's [[LexicalEnvironment]]. + 1. Let _privateEnv_ be the running execution context's [[PrivateEnvironment]]. 1. Let _sourceText_ be the source text matched by |GeneratorMethod|. 1. Let _closure_ be OrdinaryFunctionCreate(%GeneratorFunction.prototype%, _sourceText_, |UniqueFormalParameters|, |GeneratorBody|, ~non-lexical-this~, _env_, _privateEnv_). 1. Perform MakeMethod(_closure_, _object_). @@ -23989,8 +24021,8 @@

1. Let _propKey_ be ? Evaluation of |ClassElementName|. - 1. Let _env_ be the running execution context's LexicalEnvironment. - 1. Let _privateEnv_ be the running execution context's PrivateEnvironment. + 1. Let _env_ be the running execution context's [[LexicalEnvironment]]. + 1. Let _privateEnv_ be the running execution context's [[PrivateEnvironment]]. 1. Let _sourceText_ be the source text matched by |AsyncGeneratorMethod|. 1. Let _closure_ be OrdinaryFunctionCreate(%AsyncGeneratorFunction.prototype%, _sourceText_, |UniqueFormalParameters|, |AsyncGeneratorBody|, ~non-lexical-this~, _env_, _privateEnv_). 1. Perform MakeMethod(_closure_, _object_). @@ -24004,8 +24036,8 @@

1. Let _propKey_ be ? Evaluation of |ClassElementName|. - 1. Let _env_ be the LexicalEnvironment of the running execution context. - 1. Let _privateEnv_ be the running execution context's PrivateEnvironment. + 1. Let _env_ be the running execution context's [[LexicalEnvironment]]. + 1. Let _privateEnv_ be the running execution context's [[PrivateEnvironment]]. 1. Let _sourceText_ be the source text matched by |AsyncMethod|. 1. Let _closure_ be OrdinaryFunctionCreate(%AsyncFunction.prototype%, _sourceText_, |UniqueFormalParameters|, |AsyncFunctionBody|, ~non-lexical-this~, _env_, _privateEnv_). 1. Perform MakeMethod(_closure_, _object_). @@ -24167,8 +24199,8 @@

GeneratorExpression : `function` `*` `(` FormalParameters `)` `{` GeneratorBody `}` 1. If _name_ is not present, set _name_ to *""*. - 1. Let _env_ be the LexicalEnvironment of the running execution context. - 1. Let _privateEnv_ be the running execution context's PrivateEnvironment. + 1. Let _env_ be the running execution context's [[LexicalEnvironment]]. + 1. Let _privateEnv_ be the running execution context's [[PrivateEnvironment]]. 1. Let _sourceText_ be the source text matched by |GeneratorExpression|. 1. Let _closure_ be OrdinaryFunctionCreate(%GeneratorFunction.prototype%, _sourceText_, |FormalParameters|, |GeneratorBody|, ~non-lexical-this~, _env_, _privateEnv_). 1. Perform SetFunctionName(_closure_, _name_). @@ -24180,10 +24212,10 @@

1. Assert: _name_ is not present. 1. Set _name_ to the StringValue of |BindingIdentifier|. - 1. Let _outerEnv_ be the running execution context's LexicalEnvironment. + 1. Let _outerEnv_ be the running execution context's [[LexicalEnvironment]]. 1. Let _funcEnv_ be NewDeclarativeEnvironment(_outerEnv_). 1. Perform ! _funcEnv_.CreateImmutableBinding(_name_, *false*). - 1. Let _privateEnv_ be the running execution context's PrivateEnvironment. + 1. Let _privateEnv_ be the running execution context's [[PrivateEnvironment]]. 1. Let _sourceText_ be the source text matched by |GeneratorExpression|. 1. Let _closure_ be OrdinaryFunctionCreate(%GeneratorFunction.prototype%, _sourceText_, |FormalParameters|, |GeneratorBody|, ~non-lexical-this~, _funcEnv_, _privateEnv_). 1. Perform SetFunctionName(_closure_, _name_). @@ -24401,8 +24433,8 @@

1. If _name_ is not present, set _name_ to *""*. - 1. Let _env_ be the LexicalEnvironment of the running execution context. - 1. Let _privateEnv_ be the running execution context's PrivateEnvironment. + 1. Let _env_ be the running execution context's [[LexicalEnvironment]]. + 1. Let _privateEnv_ be the running execution context's [[PrivateEnvironment]]. 1. Let _sourceText_ be the source text matched by |AsyncGeneratorExpression|. 1. Let _closure_ be OrdinaryFunctionCreate(%AsyncGeneratorFunction.prototype%, _sourceText_, |FormalParameters|, |AsyncGeneratorBody|, ~non-lexical-this~, _env_, _privateEnv_). 1. Perform SetFunctionName(_closure_, _name_). @@ -24416,10 +24448,10 @@

1. Assert: _name_ is not present. 1. Set _name_ to the StringValue of |BindingIdentifier|. - 1. Let _outerEnv_ be the running execution context's LexicalEnvironment. + 1. Let _outerEnv_ be the running execution context's [[LexicalEnvironment]]. 1. Let _funcEnv_ be NewDeclarativeEnvironment(_outerEnv_). 1. Perform ! _funcEnv_.CreateImmutableBinding(_name_, *false*). - 1. Let _privateEnv_ be the running execution context's PrivateEnvironment. + 1. Let _privateEnv_ be the running execution context's [[PrivateEnvironment]]. 1. Let _sourceText_ be the source text matched by |AsyncGeneratorExpression|. 1. Let _closure_ be OrdinaryFunctionCreate(%AsyncGeneratorFunction.prototype%, _sourceText_, |FormalParameters|, |AsyncGeneratorBody|, ~non-lexical-this~, _funcEnv_, _privateEnv_). 1. Perform SetFunctionName(_closure_, _name_). @@ -24916,8 +24948,8 @@

1. Let _name_ be ? Evaluation of |ClassElementName|. 1. If |Initializer| is present, then 1. Let _formalParameterList_ be an instance of the production FormalParameters : [empty]. - 1. Let _env_ be the LexicalEnvironment of the running execution context. - 1. Let _privateEnv_ be the running execution context's PrivateEnvironment. + 1. Let _env_ be the running execution context's [[LexicalEnvironment]]. + 1. Let _privateEnv_ be the running execution context's [[PrivateEnvironment]]. 1. Let _sourceText_ be the empty sequence of Unicode code points. 1. Let _initializer_ be OrdinaryFunctionCreate(%Function.prototype%, _sourceText_, _formalParameterList_, |Initializer|, ~non-lexical-this~, _env_, _privateEnv_). 1. Perform MakeMethod(_initializer_, _homeObject_). @@ -24941,8 +24973,8 @@

ClassStaticBlock : `static` `{` ClassStaticBlockBody `}` - 1. Let _lex_ be the running execution context's LexicalEnvironment. - 1. Let _privateEnv_ be the running execution context's PrivateEnvironment. + 1. Let _lex_ be the running execution context's [[LexicalEnvironment]]. + 1. Let _privateEnv_ be the running execution context's [[PrivateEnvironment]]. 1. Let _sourceText_ be the empty sequence of Unicode code points. 1. Let _formalParameters_ be an instance of the production FormalParameters : [empty]. 1. [id="step-synthetic-class-static-block-fn"] Let _bodyFunction_ be OrdinaryFunctionCreate(%Function.prototype%, _sourceText_, _formalParameters_, |ClassStaticBlockBody|, ~non-lexical-this~, _lex_, _privateEnv_). @@ -25024,11 +25056,11 @@

ClassTail : ClassHeritage? `{` ClassBody? `}` - 1. Let _env_ be the LexicalEnvironment of the running execution context. + 1. Let _env_ be the running execution context's [[LexicalEnvironment]]. 1. Let _classEnv_ be NewDeclarativeEnvironment(_env_). 1. If _classBinding_ is not *undefined*, then 1. Perform ! _classEnv_.CreateImmutableBinding(_classBinding_, *true*). - 1. Let _outerPrivateEnvironment_ be the running execution context's PrivateEnvironment. + 1. Let _outerPrivateEnvironment_ be the running execution context's [[PrivateEnvironment]]. 1. Let _classPrivateEnvironment_ be NewPrivateEnvironment(_outerPrivateEnvironment_). 1. If |ClassBody| is present, then 1. For each String _dn_ of the PrivateBoundIdentifiers of |ClassBody|, do @@ -25041,10 +25073,10 @@

1. Let _protoParent_ be %Object.prototype%. 1. Let _constructorParent_ be %Function.prototype%. 1. Else, - 1. Set the running execution context's LexicalEnvironment to _classEnv_. - 1. NOTE: The running execution context's PrivateEnvironment is _outerPrivateEnvironment_ when evaluating |ClassHeritage|. + 1. Set the running execution context's [[LexicalEnvironment]] to _classEnv_. + 1. NOTE: The running execution context's [[PrivateEnvironment]] is _outerPrivateEnvironment_ when evaluating |ClassHeritage|. 1. Let _superclassRef_ be Completion(Evaluation of |ClassHeritage|). - 1. Set the running execution context's LexicalEnvironment to _env_. + 1. Set the running execution context's [[LexicalEnvironment]] to _env_. 1. Let _superclass_ be ? GetValue(? _superclassRef_). 1. If _superclass_ is *null*, then 1. Let _protoParent_ be *null*. @@ -25058,8 +25090,8 @@

1. Let _proto_ be OrdinaryObjectCreate(_protoParent_). 1. If |ClassBody| is not present, let _constructor_ be ~empty~. 1. Else, let _constructor_ be the ConstructorMethod of |ClassBody|. - 1. Set the running execution context's LexicalEnvironment to _classEnv_. - 1. Set the running execution context's PrivateEnvironment to _classPrivateEnvironment_. + 1. Set the running execution context's [[LexicalEnvironment]] to _classEnv_. + 1. Set the running execution context's [[PrivateEnvironment]] to _classPrivateEnvironment_. 1. If _constructor_ is ~empty~, then 1. Let _defaultConstructor_ be a new Abstract Closure with no parameters that captures nothing and performs the following steps when called: 1. Let _args_ be the List of arguments that was passed to this function by [[Call]] or [[Construct]]. @@ -25096,8 +25128,8 @@

1. Else, 1. Let _element_ be Completion(ClassElementEvaluation of _e_ with argument _F_). 1. If _element_ is an abrupt completion, then - 1. Set the running execution context's LexicalEnvironment to _env_. - 1. Set the running execution context's PrivateEnvironment to _outerPrivateEnvironment_. + 1. Set the running execution context's [[LexicalEnvironment]] to _env_. + 1. Set the running execution context's [[PrivateEnvironment]] to _outerPrivateEnvironment_. 1. Return ? _element_. 1. Set _element_ to ! _element_. 1. If _element_ is a PrivateElement, then @@ -25118,7 +25150,7 @@

1. Else, append _element_ to _staticElements_. 1. Else if _element_ is a ClassStaticBlockDefinition Record, then 1. Append _element_ to _staticElements_. - 1. Set the running execution context's LexicalEnvironment to _env_. + 1. Set the running execution context's [[LexicalEnvironment]] to _env_. 1. If _classBinding_ is not *undefined*, then 1. Perform ! _classEnv_.InitializeBinding(_classBinding_, _F_). 1. Set _F_.[[PrivateMethods]] to _instancePrivateMethods_. @@ -25132,9 +25164,9 @@

1. Assert: _elementRecord_ is a ClassStaticBlockDefinition Record. 1. Let _result_ be Completion(Call(_elementRecord_.[[BodyFunction]], _F_)). 1. If _result_ is an abrupt completion, then - 1. Set the running execution context's PrivateEnvironment to _outerPrivateEnvironment_. + 1. Set the running execution context's [[PrivateEnvironment]] to _outerPrivateEnvironment_. 1. Return ? _result_. - 1. Set the running execution context's PrivateEnvironment to _outerPrivateEnvironment_. + 1. Set the running execution context's [[PrivateEnvironment]] to _outerPrivateEnvironment_. 1. Return _F_. @@ -25148,7 +25180,7 @@

Runtime Semantics: BindingClassDeclarationEvaluation ( ): either a normal co 1. Let _className_ be the StringValue of |BindingIdentifier|. 1. Let _value_ be ? ClassDefinitionEvaluation of |ClassTail| with arguments _className_ and _className_. 1. Set _value_.[[SourceText]] to the source text matched by |ClassDeclaration|. - 1. Let _env_ be the running execution context's LexicalEnvironment. + 1. Let _env_ be the running execution context's [[LexicalEnvironment]]. 1. Perform ? InitializeBoundName(_className_, _value_, _env_). 1. Return _value_. @@ -25189,7 +25221,7 @@

Runtime Semantics: Evaluation

ClassElementName : PrivateIdentifier 1. Let _privateIdentifier_ be the StringValue of |PrivateIdentifier|. - 1. Let _privateEnvRec_ be the running execution context's PrivateEnvironment. + 1. Let _privateEnvRec_ be the running execution context's [[PrivateEnvironment]]. 1. Let _names_ be _privateEnvRec_.[[Names]]. 1. Assert: Exactly one element of _names_ is a Private Name whose [[Description]] is _privateIdentifier_. 1. Let _privateName_ be the Private Name in _names_ whose [[Description]] is _privateIdentifier_. @@ -25316,8 +25348,8 @@

1. If _name_ is not present, set _name_ to *""*. - 1. Let _env_ be the LexicalEnvironment of the running execution context. - 1. Let _privateEnv_ be the running execution context's PrivateEnvironment. + 1. Let _env_ be the running execution context's [[LexicalEnvironment]]. + 1. Let _privateEnv_ be the running execution context's [[PrivateEnvironment]]. 1. Let _sourceText_ be the source text matched by |AsyncFunctionExpression|. 1. Let _closure_ be OrdinaryFunctionCreate(%AsyncFunction.prototype%, _sourceText_, |FormalParameters|, |AsyncFunctionBody|, ~non-lexical-this~, _env_, _privateEnv_). 1. Perform SetFunctionName(_closure_, _name_). @@ -25329,10 +25361,10 @@

1. Assert: _name_ is not present. 1. Set _name_ to the StringValue of |BindingIdentifier|. - 1. Let _outerEnv_ be the LexicalEnvironment of the running execution context. + 1. Let _outerEnv_ be the running execution context's [[LexicalEnvironment]]. 1. Let _funcEnv_ be NewDeclarativeEnvironment(_outerEnv_). 1. Perform ! _funcEnv_.CreateImmutableBinding(_name_, *false*). - 1. Let _privateEnv_ be the running execution context's PrivateEnvironment. + 1. Let _privateEnv_ be the running execution context's [[PrivateEnvironment]]. 1. Let _sourceText_ be the source text matched by |AsyncFunctionExpression|. 1. Let _closure_ be OrdinaryFunctionCreate(%AsyncFunction.prototype%, _sourceText_, |FormalParameters|, |AsyncFunctionBody|, ~non-lexical-this~, _funcEnv_, _privateEnv_). 1. Perform SetFunctionName(_closure_, _name_). @@ -25487,8 +25519,8 @@

1. If _name_ is not present, set _name_ to *""*. - 1. Let _env_ be the LexicalEnvironment of the running execution context. - 1. Let _privateEnv_ be the running execution context's PrivateEnvironment. + 1. Let _env_ be the running execution context's [[LexicalEnvironment]]. + 1. Let _privateEnv_ be the running execution context's [[PrivateEnvironment]]. 1. Let _sourceText_ be the source text matched by |AsyncArrowFunction|. 1. Let _parameters_ be |AsyncArrowBindingIdentifier|. 1. Let _closure_ be OrdinaryFunctionCreate(%AsyncFunction.prototype%, _sourceText_, _parameters_, |AsyncConciseBody|, ~lexical-this~, _env_, _privateEnv_). @@ -25500,8 +25532,8 @@

1. If _name_ is not present, set _name_ to *""*. - 1. Let _env_ be the LexicalEnvironment of the running execution context. - 1. Let _privateEnv_ be the running execution context's PrivateEnvironment. + 1. Let _env_ be the running execution context's [[LexicalEnvironment]]. + 1. Let _privateEnv_ be the running execution context's [[PrivateEnvironment]]. 1. Let _sourceText_ be the source text matched by |AsyncArrowFunction|. 1. Let _head_ be the |AsyncArrowHead| that is covered by |CoverCallExpressionAndAsyncArrowHead|. 1. Let _parameters_ be the |ArrowFormalParameters| of _head_. @@ -25890,7 +25922,7 @@

PrepareForTailCall ( ): ~unused~

- 1. Assert: The current execution context will not subsequently be used for the evaluation of any ECMAScript code or built-in functions. The invocation of Call subsequent to the invocation of this abstract operation will create and push a new execution context before performing any such evaluation. + 1. Assert: The current execution context will not subsequently be used for the evaluation of any ECMAScript code or built-in functions. The invocation of Call subsequent to the invocation of this abstract operation will create and push a new ExecutionContext Record before performing any such evaluation. 1. Discard all resources associated with the current execution context. 1. Return ~unused~. @@ -26070,13 +26102,13 @@

1. Let _globalEnv_ be _scriptRecord_.[[Realm]].[[GlobalEnv]]. - 1. Let _scriptContext_ be a new ECMAScript code execution context. - 1. Set the Function of _scriptContext_ to *null*. - 1. Set the Realm of _scriptContext_ to _scriptRecord_.[[Realm]]. - 1. Set the ScriptOrModule of _scriptContext_ to _scriptRecord_. - 1. Set the VariableEnvironment of _scriptContext_ to _globalEnv_. - 1. Set the LexicalEnvironment of _scriptContext_ to _globalEnv_. - 1. Set the PrivateEnvironment of _scriptContext_ to *null*. + 1. Let _scriptContext_ be a new ECMAScript code ExecutionContext Record. + 1. Set _scriptContext_.[[Function]] to *null*. + 1. Set _scriptContext_.[[Realm]] to _scriptRecord_.[[Realm]]. + 1. Set _scriptContext_.[[ScriptOrModule]] to _scriptRecord_. + 1. Set _scriptContext_.[[VariableEnvironment]] to _globalEnv_. + 1. Set _scriptContext_.[[LexicalEnvironment]] to _globalEnv_. + 1. Set _scriptContext_.[[PrivateEnvironment]] to *null*. 1. Suspend the running execution context. 1. Push _scriptContext_ onto the execution context stack; _scriptContext_ is now the running execution context. 1. Let _script_ be _scriptRecord_.[[ECMAScriptCode]]. @@ -28270,14 +28302,14 @@

InitializeEnvironment ( ): either a normal completion containing ~unused~ or 1. Perform ! _env_.InitializeBinding(_in_.[[LocalName]], _namespace_). 1. Else, 1. Perform _env_.CreateImportBinding(_in_.[[LocalName]], _resolution_.[[Module]], _resolution_.[[BindingName]]). - 1. Let _moduleContext_ be a new ECMAScript code execution context. - 1. Set the Function of _moduleContext_ to *null*. + 1. Let _moduleContext_ be a new ECMAScript code ExecutionContext Record. + 1. Set _moduleContext_.[[Function]] to *null*. 1. Assert: _module_.[[Realm]] is not *undefined*. - 1. Set the Realm of _moduleContext_ to _module_.[[Realm]]. - 1. Set the ScriptOrModule of _moduleContext_ to _module_. - 1. Set the VariableEnvironment of _moduleContext_ to _module_.[[Environment]]. - 1. Set the LexicalEnvironment of _moduleContext_ to _module_.[[Environment]]. - 1. Set the PrivateEnvironment of _moduleContext_ to *null*. + 1. Set _moduleContext_.[[Realm]] to _module_.[[Realm]]. + 1. Set _moduleContext_.[[ScriptOrModule]] to _module_. + 1. Set _moduleContext_.[[VariableEnvironment]] to _module_.[[Environment]]. + 1. Set _moduleContext_.[[LexicalEnvironment]] to _module_.[[Environment]]. + 1. Set _moduleContext_.[[PrivateEnvironment]] to *null*. 1. Set _module_.[[Context]] to _moduleContext_. 1. Push _moduleContext_ onto the execution context stack; _moduleContext_ is now the running execution context. 1. Let _code_ be _module_.[[ECMAScriptCode]]. @@ -28317,13 +28349,13 @@

- 1. Let _moduleContext_ be a new ECMAScript code execution context. - 1. Set the Function of _moduleContext_ to *null*. - 1. Set the Realm of _moduleContext_ to _module_.[[Realm]]. - 1. Set the ScriptOrModule of _moduleContext_ to _module_. + 1. Let _moduleContext_ be a new ECMAScript code ExecutionContext Record. + 1. Set _moduleContext_.[[Function]] to *null*. + 1. Set _moduleContext_.[[Realm]] to _module_.[[Realm]]. + 1. Set _moduleContext_.[[ScriptOrModule]] to _module_. 1. Assert: _module_ has been linked and declarations in its module environment have been instantiated. - 1. Set the VariableEnvironment of _moduleContext_ to _module_.[[Environment]]. - 1. Set the LexicalEnvironment of _moduleContext_ to _module_.[[Environment]]. + 1. Set _moduleContext_.[[VariableEnvironment]] to _module_.[[Environment]]. + 1. Set _moduleContext_.[[LexicalEnvironment]] to _module_.[[Environment]]. 1. Suspend the running execution context. 1. If _module_.[[HasTLA]] is *false*, then 1. Assert: _capability_ is not present. @@ -28379,7 +28411,7 @@

<button type="button" onclick="import('./foo.mjs')">Click me</button>
-

there will be no active script or module at the time the `import()` expression runs. More generally, this can happen in any situation where the host pushes execution contexts with *null* ScriptOrModule components onto the execution context stack.

+

there will be no active script or module at the time the `import()` expression runs. More generally, this can happen in any situation where the host pushes an ExecutionContext Record with a *null* [[ScriptOrModule]] field onto the execution context stack.

An implementation of HostLoadImportedModule must conform to the following requirements:

@@ -29000,7 +29032,7 @@

Runtime Semantics: Evaluation

1. Let _value_ be ? BindingClassDeclarationEvaluation of |ClassDeclaration|. 1. Let _className_ be the sole element of the BoundNames of |ClassDeclaration|. 1. If _className_ is *"\*default\*"*, then - 1. Let _env_ be the running execution context's LexicalEnvironment. + 1. Let _env_ be the running execution context's [[LexicalEnvironment]]. 1. Perform ? InitializeBoundName(*"\*default\*"*, _value_, _env_). 1. Return ~empty~.
@@ -29011,7 +29043,7 @@

Runtime Semantics: Evaluation

1. Else, 1. Let _rhs_ be ? Evaluation of |AssignmentExpression|. 1. Let _value_ be ? GetValue(_rhs_). - 1. Let _env_ be the running execution context's LexicalEnvironment. + 1. Let _env_ be the running execution context's [[LexicalEnvironment]]. 1. Perform ? InitializeBoundName(*"\*default\*"*, _value_, _env_). 1. Return ~empty~.
@@ -29195,22 +29227,22 @@

1. Let _runningContext_ be the running execution context. 1. NOTE: If _direct_ is *true*, _runningContext_ will be the execution context that performed the direct eval. If _direct_ is *false*, _runningContext_ will be the execution context for the invocation of the `eval` function. 1. If _direct_ is *true*, then - 1. Let _lexEnv_ be NewDeclarativeEnvironment(_runningContext_'s LexicalEnvironment). - 1. Let _varEnv_ be _runningContext_'s VariableEnvironment. - 1. Let _privateEnv_ be _runningContext_'s PrivateEnvironment. + 1. Let _lexEnv_ be NewDeclarativeEnvironment(_runningContext_.[[LexicalEnvironment]]). + 1. Let _varEnv_ be _runningContext_.[[VariableEnvironment]]. + 1. Let _privateEnv_ be _runningContext_.[[PrivateEnvironment]]. 1. Else, 1. Let _lexEnv_ be NewDeclarativeEnvironment(_evalRealm_.[[GlobalEnv]]). 1. Let _varEnv_ be _evalRealm_.[[GlobalEnv]]. 1. Let _privateEnv_ be *null*. 1. If _strictEval_ is *true*, set _varEnv_ to _lexEnv_. 1. If _runningContext_ is not already suspended, suspend _runningContext_. - 1. Let _evalContext_ be a new ECMAScript code execution context. - 1. Set _evalContext_'s Function to *null*. - 1. Set _evalContext_'s Realm to _evalRealm_. - 1. Set _evalContext_'s ScriptOrModule to _runningContext_'s ScriptOrModule. - 1. Set _evalContext_'s VariableEnvironment to _varEnv_. - 1. Set _evalContext_'s LexicalEnvironment to _lexEnv_. - 1. Set _evalContext_'s PrivateEnvironment to _privateEnv_. + 1. Let _evalContext_ be a new ECMAScript code ExecutionContext Record. + 1. Set _evalContext_.[[Function]] to *null*. + 1. Set _evalContext_.[[Realm]] to _evalRealm_. + 1. Set _evalContext_.[[ScriptOrModule]] to _runningContext_.[[ScriptOrModule]]. + 1. Set _evalContext_.[[VariableEnvironment]] to _varEnv_. + 1. Set _evalContext_.[[LexicalEnvironment]] to _lexEnv_. + 1. Set _evalContext_.[[PrivateEnvironment]] to _privateEnv_. 1. Push _evalContext_ onto the execution context stack; _evalContext_ is now the running execution context. 1. Let _result_ be Completion(EvalDeclarationInstantiation(_body_, _varEnv_, _lexEnv_, _privateEnv_, _strictEval_)). 1. If _result_ is a normal completion, then @@ -29222,7 +29254,7 @@

1. Return ? _result_. -

The eval code cannot instantiate variable or function bindings in the variable environment of the calling context that invoked the eval if either the code of the calling context or the eval code is strict mode code. Instead such bindings are instantiated in a new VariableEnvironment that is only accessible to the eval code. Bindings introduced by `let`, `const`, or `class` declarations are always instantiated in a new LexicalEnvironment.

+

The eval code cannot instantiate variable or function bindings in the variable environment of the calling context that invoked the eval if either the code of the calling context or the eval code is strict mode code. Instead such bindings are instantiated in a new [[VariableEnvironment]] that is only accessible to the eval code. Bindings introduced by `let`, `const`, or `class` declarations are always instantiated in a new [[LexicalEnvironment]].

@@ -48727,10 +48759,10 @@

1. Assert: The value of _generator_.[[GeneratorState]] is ~suspended-start~. 1. Let _genContext_ be the running execution context. - 1. Set the Generator component of _genContext_ to _generator_. + 1. Set _genContext_.[[Generator]] to _generator_. 1. Let _closure_ be a new Abstract Closure with no parameters that captures _generatorBody_ and performs the following steps when called: 1. Let _acGenContext_ be the running execution context. - 1. Let _acGenerator_ be the Generator component of _acGenContext_. + 1. Let _acGenerator_ be _acGenContext_.[[Generator]]. 1. If _generatorBody_ is a Parse Node, then 1. Let _result_ be Completion(Evaluation of _generatorBody_). 1. Else, @@ -48748,7 +48780,7 @@

1. Assert: _result_ is a throw completion. 1. Return ? _result_. 1. Return CreateIteratorResultObject(_resultValue_, *true*). - 1. Set the code evaluation state of _genContext_ such that when evaluation is resumed for that execution context, _closure_ will be called with no arguments. + 1. Set _genContext_.[[CodeEvaluationState]] such that when evaluation is resumed for that execution context, _closure_ will be called with no arguments. 1. Set _generator_.[[GeneratorContext]] to _genContext_. 1. Return ~unused~. @@ -48837,8 +48869,8 @@

GetGeneratorKind ( ): ~non-generator~, ~sync~, or ~async~

1. Let _genContext_ be the running execution context. - 1. If _genContext_ does not have a Generator component, return ~non-generator~. - 1. Let _generator_ be the Generator component of _genContext_. + 1. If _genContext_ does not have a [[Generator]] field, return ~non-generator~. + 1. Let _generator_ be _genContext_.[[Generator]]. 1. If _generator_ has an [[AsyncGeneratorState]] internal slot, return ~async~. 1. Else, return ~sync~. @@ -48855,7 +48887,7 @@

1. Let _genContext_ be the running execution context. 1. Assert: _genContext_ is the execution context of a generator. - 1. Let _generator_ be the value of the Generator component of _genContext_. + 1. Let _generator_ be _genContext_.[[Generator]]. 1. Assert: GetGeneratorKind() is ~sync~. 1. Set _generator_.[[GeneratorState]] to ~suspended-yield~. 1. Remove _genContext_ from the execution context stack and restore the execution context that is at the top of the execution context stack as the running execution context. @@ -48900,10 +48932,10 @@

1. Set _generator_.[[GeneratorBrand]] to _generatorBrand_. 1. Set _generator_.[[GeneratorState]] to ~suspended-start~. 1. Let _callerContext_ be the running execution context. - 1. Let _calleeContext_ be a new execution context. - 1. Set the Function of _calleeContext_ to *null*. - 1. Set the Realm of _calleeContext_ to the current Realm Record. - 1. Set the ScriptOrModule of _calleeContext_ to _callerContext_'s ScriptOrModule. + 1. Let _calleeContext_ be a new ExecutionContext Record. + 1. Set _calleeContext_.[[Function]] to *null*. + 1. Set _calleeContext_.[[Realm]] to the current Realm Record. + 1. Set _calleeContext_.[[ScriptOrModule]] to _callerContext_.[[ScriptOrModule]]. 1. If _callerContext_ is not already suspended, suspend _callerContext_. 1. Push _calleeContext_ onto the execution context stack; _calleeContext_ is now the running execution context. 1. Perform GeneratorStart(_generator_, _closure_). @@ -49089,10 +49121,10 @@

1. Assert: _generator_.[[AsyncGeneratorState]] is ~suspended-start~. 1. Let _genContext_ be the running execution context. - 1. Set the Generator component of _genContext_ to _generator_. + 1. Set _genContext_.[[Generator]] to _generator_. 1. Let _closure_ be a new Abstract Closure with no parameters that captures _generatorBody_ and performs the following steps when called: 1. Let _acGenContext_ be the running execution context. - 1. Let _acGenerator_ be the Generator component of _acGenContext_. + 1. Let _acGenerator_ be _acGenContext_.[[Generator]]. 1. If _generatorBody_ is a Parse Node, then 1. Let _result_ be Completion(Evaluation of _generatorBody_). 1. Else, @@ -49106,7 +49138,7 @@

1. Perform AsyncGeneratorCompleteStep(_acGenerator_, _result_, *true*). 1. Perform AsyncGeneratorDrainQueue(_acGenerator_). 1. Return *undefined*. - 1. Set the code evaluation state of _genContext_ such that when evaluation is resumed for that execution context, _closure_ will be called with no arguments. + 1. Set _genContext_.[[CodeEvaluationState]] such that when evaluation is resumed for that execution context, _closure_ will be called with no arguments. 1. Set _generator_.[[AsyncGeneratorContext]] to _genContext_. 1. Set _generator_.[[AsyncGeneratorQueue]] to a new empty List. 1. Return ~unused~. @@ -49170,10 +49202,10 @@

1. Else, 1. Assert: _completion_ is a normal completion. 1. If _realm_ is present, then - 1. Let _oldRealm_ be the running execution context's Realm. - 1. Set the running execution context's Realm to _realm_. + 1. Let _oldRealm_ be the running execution context's [[Realm]]. + 1. Set the running execution context's [[Realm]] to _realm_. 1. Let _iteratorResult_ be CreateIteratorResultObject(_value_, _done_). - 1. Set the running execution context's Realm to _oldRealm_. + 1. Set the running execution context's [[Realm]] to _oldRealm_. 1. Else, 1. Let _iteratorResult_ be CreateIteratorResultObject(_value_, _done_). 1. Perform ! Call(_promiseCapability_.[[Resolve]], *undefined*, « _iteratorResult_ »). @@ -49232,12 +49264,12 @@

1. Let _genContext_ be the running execution context. 1. Assert: _genContext_ is the execution context of a generator. - 1. Let _generator_ be the value of the Generator component of _genContext_. + 1. Let _generator_ be _genContext_.[[Generator]]. 1. Assert: GetGeneratorKind() is ~async~. 1. Let _completion_ be NormalCompletion(_value_). 1. Assert: The execution context stack has at least two elements. 1. Let _previousContext_ be the second to top element of the execution context stack. - 1. Let _previousRealm_ be _previousContext_'s Realm. + 1. Let _previousRealm_ be _previousContext_.[[Realm]]. 1. Perform AsyncGeneratorCompleteStep(_generator_, _completion_, *false*, _previousRealm_). 1. Let _queue_ be _generator_.[[AsyncGeneratorQueue]]. 1. If _queue_ is not empty, then @@ -49347,10 +49379,10 @@

1. Set _generator_.[[GeneratorBrand]] to _generatorBrand_. 1. Set _generator_.[[AsyncGeneratorState]] to *undefined*. 1. Let _callerContext_ be the running execution context. - 1. Let _calleeContext_ be a new execution context. - 1. Set the Function of _calleeContext_ to *null*. - 1. Set the Realm of _calleeContext_ to the current Realm Record. - 1. Set the ScriptOrModule of _calleeContext_ to _callerContext_'s ScriptOrModule. + 1. Let _calleeContext_ be a new ExecutionContext Record. + 1. Set _calleeContext_.[[Function]] to *null*. + 1. Set _calleeContext_.[[Realm]] to the current Realm Record. + 1. Set _calleeContext_.[[ScriptOrModule]] to _callerContext_.[[ScriptOrModule]]. 1. If _callerContext_ is not already suspended, suspend _callerContext_. 1. Push _calleeContext_ onto the execution context stack; _calleeContext_ is now the running execution context. 1. Perform AsyncGeneratorStart(_generator_, _closure_). @@ -49505,7 +49537,7 @@

1. Assert: _result_ is a throw completion. 1. Perform ! Call(_promiseCapability_.[[Reject]], *undefined*, « _result_.[[Value]] »). 1. [id="step-asyncblockstart-return-undefined"] Return ~unused~. - 1. Set the code evaluation state of _asyncContext_ such that when evaluation is resumed for that execution context, _closure_ will be called with no arguments. + 1. Set _asyncContext_.[[CodeEvaluationState]] such that when evaluation is resumed for that execution context, _closure_ will be called with no arguments. 1. Push _asyncContext_ onto the execution context stack; _asyncContext_ is now the running execution context. 1. Resume the suspended evaluation of _asyncContext_. Let _result_ be the value returned by the resumed computation. 1. Assert: When we return here, _asyncContext_ has already been removed from the execution context stack and _runningContext_ is the currently running execution context. @@ -51683,8 +51715,8 @@

Changes to FunctionDeclarationInstantiation

1. Perform ! _varEnv_.InitializeBinding(_F_, *undefined*). 1. Append _F_ to _instantiatedVarNames_. 1. When the |FunctionDeclaration| _f_ is evaluated, perform the following steps in place of the |FunctionDeclaration| Evaluation algorithm provided in : - 1. Let _fEnv_ be the running execution context's VariableEnvironment. - 1. Let _bEnv_ be the running execution context's LexicalEnvironment. + 1. Let _fEnv_ be the running execution context's [[VariableEnvironment]]. + 1. Let _bEnv_ be the running execution context's [[LexicalEnvironment]]. 1. Let _fObj_ be ! _bEnv_.GetBindingValue(_F_, *false*). 1. Perform ! _fEnv_.SetMutableBinding(_F_, _fObj_, *false*). 1. Return ~unused~. @@ -51710,8 +51742,8 @@

Changes to GlobalDeclarationInstantiation

1. Perform ? _env_.CreateGlobalVarBinding(_F_, *false*). 1. Append _F_ to _declaredFunctionOrVarNames_. 1. When the |FunctionDeclaration| _f_ is evaluated, perform the following steps in place of the |FunctionDeclaration| Evaluation algorithm provided in : - 1. Let _gEnv_ be the running execution context's VariableEnvironment. - 1. Let _bEnv_ be the running execution context's LexicalEnvironment. + 1. Let _gEnv_ be the running execution context's [[VariableEnvironment]]. + 1. Let _bEnv_ be the running execution context's [[LexicalEnvironment]]. 1. Let _fObj_ be ! _bEnv_.GetBindingValue(_F_, *false*). 1. Perform ? _gEnv_.SetMutableBinding(_F_, _fObj_, *false*). 1. Return ~unused~. @@ -51753,8 +51785,8 @@

Changes to EvalDeclarationInstantiation

1. Perform ! _varEnv_.InitializeBinding(_F_, *undefined*). 1. Append _F_ to _declaredFunctionOrVarNames_. 1. When the |FunctionDeclaration| _f_ is evaluated, perform the following steps in place of the |FunctionDeclaration| Evaluation algorithm provided in : - 1. Let _gEnv_ be the running execution context's VariableEnvironment. - 1. Let _bEnv_ be the running execution context's LexicalEnvironment. + 1. Let _gEnv_ be the running execution context's [[VariableEnvironment]]. + 1. Let _bEnv_ be the running execution context's [[LexicalEnvironment]]. 1. Let _fObj_ be ! _bEnv_.GetBindingValue(_F_, *false*). 1. Perform ? _gEnv_.SetMutableBinding(_F_, _fObj_, *false*). 1. Return ~unused~. From 7b6f841351a6a8fa28bfe4ff842421d814261b5a Mon Sep 17 00:00:00 2001 From: Michael Dyck Date: Wed, 31 Aug 2022 23:32:48 -0400 Subject: [PATCH 2/7] fixup: "execution context" -> "ExecutionContext Record" in the of ECMAScript code execution contexts --- spec.html | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/spec.html b/spec.html index 1414fb0aae..738cd6b883 100644 --- a/spec.html +++ b/spec.html @@ -11909,7 +11909,7 @@

Execution Contexts

Evaluation of code by the running execution context may be suspended at various points defined within this specification. Once the running execution context has been suspended a different execution context may become the running execution context and commence evaluating its code. At some later time a suspended execution context may again become the running execution context and continue evaluating its code at the point where it had previously been suspended. Transition of the running execution context status among execution contexts usually occurs in stack-like last-in/first-out manner. However, some ECMAScript features require non-LIFO transitions of the running execution context.

The value of the running execution context's [[Realm]] field is also called the current Realm Record. The value of the running execution context's [[Function]] field is also called the active function object.

-

ECMAScript code execution contexts have the additional fields listed in .

+

ECMAScript code ExecutionContext Records have the additional fields listed in .

From cbb13c43600a517fd8ffad85262c90a3709b252e Mon Sep 17 00:00:00 2001 From: Michael Dyck Date: Wed, 31 Aug 2022 20:24:28 -0400 Subject: [PATCH 3/7] fixup: "execution context" -> "ExecutionContext Record" in AO headers --- spec.html | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/spec.html b/spec.html index 738cd6b883..43400a8c31 100644 --- a/spec.html +++ b/spec.html @@ -13447,7 +13447,7 @@

PrepareForOrdinaryCall ( _F_: an ECMAScript function object, _newTarget_: an Object or *undefined*, - ): an execution context + ): an ExecutionContext Record

@@ -13473,7 +13473,7 @@

OrdinaryCallBindThis ( _F_: an ECMAScript function object, - _calleeContext_: an execution context, + _calleeContext_: an ExecutionContext Record, _thisArgument_: an ECMAScript language value, ): ~unused~

@@ -49513,7 +49513,7 @@

AsyncBlockStart ( _promiseCapability_: a PromiseCapability Record, _asyncBody_: a Parse Node or an Abstract Closure with no parameters, - _asyncContext_: an execution context, + _asyncContext_: an ExecutionContext Record, ): ~unused~

From 790d75325aa4bc6ca8b55a1d16a2c75151402cea Mon Sep 17 00:00:00 2001 From: Michael Dyck Date: Wed, 31 Aug 2022 20:30:10 -0400 Subject: [PATCH 4/7] fixup: "execution context" -> "ExecutionContext Record" in record-field tables --- spec.html | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/spec.html b/spec.html index 43400a8c31..1aaab41d06 100644 --- a/spec.html +++ b/spec.html @@ -27657,10 +27657,10 @@

Source Text Module Records

[[Context]]
@@ -48723,10 +48723,10 @@

Properties of Generator Instances

[[GeneratorContext]] @@ -49062,8 +49062,8 @@

Properties of AsyncGenerator Instances

- - + + From e01ed174ba0d18c369b4a9b6a0f1f963cfc5c523 Mon Sep 17 00:00:00 2001 From: Michael Dyck Date: Wed, 31 Aug 2022 23:13:29 -0400 Subject: [PATCH 5/7] fixup: Avoid saying "that execution context" by naming it --- spec.html | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/spec.html b/spec.html index 1aaab41d06..70796baaa6 100644 --- a/spec.html +++ b/spec.html @@ -48780,7 +48780,7 @@

1. Assert: _result_ is a throw completion. 1. Return ? _result_. 1. Return CreateIteratorResultObject(_resultValue_, *true*). - 1. Set _genContext_.[[CodeEvaluationState]] such that when evaluation is resumed for that execution context, _closure_ will be called with no arguments. + 1. Set _genContext_.[[CodeEvaluationState]] such that when evaluation is resumed for _genContext_, _closure_ will be called with no arguments. 1. Set _generator_.[[GeneratorContext]] to _genContext_. 1. Return ~unused~. @@ -49138,7 +49138,7 @@

1. Perform AsyncGeneratorCompleteStep(_acGenerator_, _result_, *true*). 1. Perform AsyncGeneratorDrainQueue(_acGenerator_). 1. Return *undefined*. - 1. Set _genContext_.[[CodeEvaluationState]] such that when evaluation is resumed for that execution context, _closure_ will be called with no arguments. + 1. Set _genContext_.[[CodeEvaluationState]] such that when evaluation is resumed for _genContext_, _closure_ will be called with no arguments. 1. Set _generator_.[[AsyncGeneratorContext]] to _genContext_. 1. Set _generator_.[[AsyncGeneratorQueue]] to a new empty List. 1. Return ~unused~. @@ -49537,7 +49537,7 @@

1. Assert: _result_ is a throw completion. 1. Perform ! Call(_promiseCapability_.[[Reject]], *undefined*, « _result_.[[Value]] »). 1. [id="step-asyncblockstart-return-undefined"] Return ~unused~. - 1. Set _asyncContext_.[[CodeEvaluationState]] such that when evaluation is resumed for that execution context, _closure_ will be called with no arguments. + 1. Set _asyncContext_.[[CodeEvaluationState]] such that when evaluation is resumed for _asyncContext_, _closure_ will be called with no arguments. 1. Push _asyncContext_ onto the execution context stack; _asyncContext_ is now the running execution context. 1. Resume the suspended evaluation of _asyncContext_. Let _result_ be the value returned by the resumed computation. 1. Assert: When we return here, _asyncContext_ has already been removed from the execution context stack and _runningContext_ is the currently running execution context. From 253058125c0c1947786c3608455b4721e08dcbff Mon Sep 17 00:00:00 2001 From: Michael Dyck Date: Wed, 31 Aug 2022 23:31:55 -0400 Subject: [PATCH 6/7] fixup: "execution context" -> "ExecutionContext Record" in some alg steps --- spec.html | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/spec.html b/spec.html index 70796baaa6..f399713675 100644 --- a/spec.html +++ b/spec.html @@ -12001,8 +12001,8 @@

GetActiveScriptOrModule ( ): a Script Record, a Module Record, or *null*

1. If the execution context stack is empty, return *null*. - 1. Let _ec_ be the topmost execution context on the execution context stack whose [[ScriptOrModule]] field is not *null*. - 1. If no such execution context exists, return *null*. Otherwise, return _ec_.[[ScriptOrModule]]. + 1. Let _ec_ be the topmost ExecutionContext Record on the execution context stack whose [[ScriptOrModule]] field is not *null*. + 1. If no such ExecutionContext Record exists, return *null*. Otherwise, return _ec_.[[ScriptOrModule]]. @@ -48769,7 +48769,7 @@

1. Assert: _generatorBody_ is an Abstract Closure with no parameters. 1. Let _result_ be _generatorBody_(). 1. Assert: If we return here, the generator either threw an exception or performed either an implicit or explicit return. - 1. Remove _acGenContext_ from the execution context stack and restore the execution context that is at the top of the execution context stack as the running execution context. + 1. Remove _acGenContext_ from the execution context stack and restore the ExecutionContext Record that is at the top of the execution context stack as the running execution context. 1. Set _acGenerator_.[[GeneratorState]] to ~completed~. 1. NOTE: Once a generator enters the ~completed~ state it never leaves it and its associated execution context is never resumed. Any execution state associated with _acGenerator_ can be discarded at this point. 1. If _result_ is a normal completion, then @@ -48890,7 +48890,7 @@

1. Let _generator_ be _genContext_.[[Generator]]. 1. Assert: GetGeneratorKind() is ~sync~. 1. Set _generator_.[[GeneratorState]] to ~suspended-yield~. - 1. Remove _genContext_ from the execution context stack and restore the execution context that is at the top of the execution context stack as the running execution context. + 1. Remove _genContext_ from the execution context stack and restore the ExecutionContext Record that is at the top of the execution context stack as the running execution context. 1. Let _callerContext_ be the running execution context. 1. Resume _callerContext_ passing NormalCompletion(_iteratorResult_). If _genContext_ is ever resumed again, let _resumptionValue_ be the Completion Record with which it is resumed. 1. Assert: If control reaches here, then _genContext_ is the running execution context again. @@ -49131,7 +49131,7 @@

1. Assert: _generatorBody_ is an Abstract Closure with no parameters. 1. Let _result_ be Completion(_generatorBody_()). 1. Assert: If we return here, the async generator either threw an exception or performed either an implicit or explicit return. - 1. Remove _acGenContext_ from the execution context stack and restore the execution context that is at the top of the execution context stack as the running execution context. + 1. Remove _acGenContext_ from the execution context stack and restore the ExecutionContext Record that is at the top of the execution context stack as the running execution context. 1. Set _acGenerator_.[[AsyncGeneratorState]] to ~draining-queue~. 1. If _result_ is a normal completion, set _result_ to NormalCompletion(*undefined*). 1. If _result_ is a return completion, set _result_ to NormalCompletion(_result_.[[Value]]). @@ -49279,7 +49279,7 @@

1. Return ? AsyncGeneratorUnwrapYieldResumption(_resumptionValue_). 1. Else, 1. Set _generator_.[[AsyncGeneratorState]] to ~suspended-yield~. - 1. Remove _genContext_ from the execution context stack and restore the execution context that is at the top of the execution context stack as the running execution context. + 1. Remove _genContext_ from the execution context stack and restore the ExecutionContext Record that is at the top of the execution context stack as the running execution context. 1. Let _callerContext_ be the running execution context. 1. Resume _callerContext_ passing *undefined*. If _genContext_ is ever resumed again, let _resumptionValue_ be the Completion Record with which it is resumed. 1. Assert: If control reaches here, then _genContext_ is the running execution context again. @@ -49528,7 +49528,7 @@

1. Assert: _asyncBody_ is an Abstract Closure with no parameters. 1. Let _result_ be _asyncBody_(). 1. Assert: If we return here, the async function either threw an exception or performed an implicit or explicit return; all awaiting is done. - 1. Remove _acAsyncContext_ from the execution context stack and restore the execution context that is at the top of the execution context stack as the running execution context. + 1. Remove _acAsyncContext_ from the execution context stack and restore the ExecutionContext Record that is at the top of the execution context stack as the running execution context. 1. If _result_ is a normal completion, then 1. Perform ! Call(_promiseCapability_.[[Resolve]], *undefined*, « *undefined* »). 1. Else if _result_ is a return completion, then @@ -49574,7 +49574,7 @@

1. Return *undefined*. 1. Let _onRejected_ be CreateBuiltinFunction(_rejectedClosure_, 1, *""*, « »). 1. Perform PerformPromiseThen(_promise_, _onFulfilled_, _onRejected_). - 1. Remove _asyncContext_ from the execution context stack and restore the execution context that is at the top of the execution context stack as the running execution context. + 1. Remove _asyncContext_ from the execution context stack and restore the ExecutionContext Record that is at the top of the execution context stack as the running execution context. 1. Let _callerContext_ be the running execution context. 1. Resume _callerContext_ passing ~empty~. If _asyncContext_ is ever resumed again, let _completion_ be the Completion Record with which it is resumed. 1. Assert: If control reaches here, then _asyncContext_ is the running execution context again. From 8e2bd10b227de144673c53a10f99f78ee8aeb62f Mon Sep 17 00:00:00 2001 From: Michael Dyck Date: Wed, 31 Aug 2022 23:46:33 -0400 Subject: [PATCH 7/7] fixup: "execution context" -> "ExecutionContext Record" in some prose --- spec.html | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/spec.html b/spec.html index f399713675..20eeca471d 100644 --- a/spec.html +++ b/spec.html @@ -11902,7 +11902,7 @@

Execution Contexts

a Module Record, a Script Record, or *null*

- an ECMAScript code execution context or ~empty~ + an ECMAScript code ExecutionContext Record or ~empty~ - The execution context associated with this module. It is ~empty~ until the module's environment has been initialized. + The ExecutionContext Record associated with this module. It is ~empty~ until the module's environment has been initialized.
- an execution context + an ExecutionContext Record - The execution context that is used when executing the code of this generator. + The ExecutionContext Record that is used when executing the code of this generator.
[[AsyncGeneratorContext]]an execution contextThe execution context that is used when executing the code of this async generator.an ExecutionContext RecordThe ExecutionContext Record that is used when executing the code of this async generator.
[[AsyncGeneratorQueue]] - The Module Record or Script Record from which associated code originates. If there is no originating script or module, as is the case for the original execution context created in InitializeHostDefinedRealm, the value is *null*. + The Module Record or Script Record from which associated code originates. If there is no originating script or module, as is the case for the original ExecutionContext Record created in InitializeHostDefinedRealm, the value is *null*.
@@ -12112,18 +12112,18 @@

Jobs and Host Operations to Enqueue Jobs

At any particular time, _scriptOrModule_ (a Script Record, a Module Record, or *null*) is the active script or module if all of the following conditions are true:

  • GetActiveScriptOrModule() is _scriptOrModule_.
  • -
  • If _scriptOrModule_ is a Script Record or Module Record, let _ec_ be the topmost execution context on the execution context stack whose [[ScriptOrModule]] field is _scriptOrModule_. _ec_.[[Realm]] is _scriptOrModule_.[[Realm]].
  • +
  • If _scriptOrModule_ is a Script Record or Module Record, let _ec_ be the topmost ExecutionContext Record on the execution context stack whose [[ScriptOrModule]] field is _scriptOrModule_. _ec_.[[Realm]] is _scriptOrModule_.[[Realm]].

At any particular time, an execution is prepared to evaluate ECMAScript code if all of the following conditions are true:

  • The execution context stack is not empty.
  • -
  • The [[Realm]] field of the topmost execution context on the execution context stack is a Realm Record.
  • +
  • The [[Realm]] field of the topmost ExecutionContext Record on the execution context stack is a Realm Record.
-

Host environments may prepare an execution to evaluate code by pushing execution contexts onto the execution context stack. The specific steps are implementation-defined.

-

The specific choice of Realm is up to the host environment. This initial execution context and Realm is only in use before any callback function is invoked. When a callback function related to a Job, like a Promise handler, is invoked, the invocation pushes its own execution context and Realm.

+

Host environments may prepare an execution to evaluate code by pushing ExecutionContext Records onto the execution context stack. The specific steps are implementation-defined.

+

The specific choice of Realm is up to the host environment. This initial ExecutionContext Record and Realm is only in use before any callback function is invoked. When a callback function related to a Job, like a Promise handler, is invoked, the invocation pushes its own ExecutionContext Record and Realm.

Particular kinds of Jobs have additional conformance requirements.