diff --git a/spec.html b/spec.html index 6a6c7e4a90..8056317b1e 100644 --- a/spec.html +++ b/spec.html @@ -3927,7 +3927,7 @@

Well-Known Intrinsic Objects

ECMAScript Specification Types

-

A specification type corresponds to meta-values that are used within algorithms to describe the semantics of ECMAScript language constructs and ECMAScript language types. The specification types include Reference, List, Completion, Property Descriptor, Lexical Environment, Environment Record, Abstract Closure, and Data Block. Specification type values are specification artefacts that do not necessarily correspond to any specific entity within an ECMAScript implementation. Specification type values may be used to describe intermediate results of ECMAScript expression evaluation but such values cannot be stored as properties of objects or values of ECMAScript language variables.

+

A specification type corresponds to meta-values that are used within algorithms to describe the semantics of ECMAScript language constructs and ECMAScript language types. The specification types include Reference, List, Completion, Property Descriptor, Environment Record, Abstract Closure, and Data Block. Specification type values are specification artefacts that do not necessarily correspond to any specific entity within an ECMAScript implementation. Specification type values may be used to describe intermediate results of ECMAScript expression evaluation but such values cannot be stored as properties of objects or values of ECMAScript language variables.

The List and Record Specification Types

@@ -4414,8 +4414,8 @@

CompletePropertyDescriptor ( _Desc_ )

-

The Lexical Environment and Environment Record Specification Types

-

The Lexical Environment and Environment Record types are used to explain the behaviour of name resolution in nested functions and blocks. These types and the operations upon them are defined in .

+

The Environment Record Specification Type

+

The Environment Record type is used to explain the behaviour of name resolution in nested functions and blocks. This type and the operations upon it are defined in .

@@ -6188,20 +6188,41 @@

ListIteratorNext Functions

Executable Code and Execution Contexts

- -

Lexical Environments

-

A Lexical Environment is a specification type used to define the association of |Identifier|s to specific variables and functions based upon the lexical nesting structure of ECMAScript code. A Lexical Environment consists of an Environment Record and a possibly null reference to an outer Lexical Environment. Usually a Lexical Environment is associated with some specific syntactic structure of ECMAScript code such as a |FunctionDeclaration|, a |BlockStatement|, or a |Catch| clause of a |TryStatement| and a new Lexical Environment is created each time such code is evaluated.

-

An Environment Record records the identifier bindings that are created within the scope of its associated Lexical Environment. It is referred to as the Lexical Environment's EnvironmentRecord.

-

The outer environment reference is used to model the logical nesting of Lexical Environment values. The outer reference of a (inner) Lexical Environment is a reference to the Lexical Environment that logically surrounds the inner Lexical Environment. An outer Lexical Environment may, of course, have its own outer Lexical Environment. A Lexical Environment may serve as the outer environment for multiple inner Lexical Environments. For example, if a |FunctionDeclaration| contains two nested |FunctionDeclaration|s then the Lexical Environments of each of the nested functions will have as their outer Lexical Environment the Lexical Environment of the current evaluation of the surrounding function.

-

A global environment is a Lexical Environment which does not have an outer environment. The global environment's outer environment reference is *null*. A global environment's EnvironmentRecord may be prepopulated with identifier bindings and includes an associated global object whose properties provide some of the global environment's identifier bindings. As ECMAScript code is executed, additional properties may be added to the global object and the initial properties may be modified.

-

A module environment is a Lexical Environment that contains the bindings for the top level declarations of a |Module|. It also contains the bindings that are explicitly imported by the |Module|. The outer environment of a module environment is a global environment.

-

A function environment is a Lexical Environment that corresponds to the invocation of an ECMAScript function object. A function environment may establish a new `this` binding. A function environment also captures the state necessary to support `super` method invocations.

-

Lexical Environments and Environment Record values are purely specification mechanisms and need not correspond to any specific artefact of an ECMAScript implementation. It is impossible for an ECMAScript program to directly access or manipulate such values.

- - -

Environment Records

-

There are two primary kinds of Environment Record values used in this specification: declarative Environment Records and object Environment Records. Declarative Environment Records are used to define the effect of ECMAScript language syntactic elements such as |FunctionDeclaration|s, |VariableDeclaration|s, and |Catch| clauses that directly associate identifier bindings with ECMAScript language values. Object Environment Records are used to define the effect of ECMAScript elements such as |WithStatement| that associate identifier bindings with the properties of some object. Global Environment Records and function Environment Records are specializations that are used for specifically for |Script| global declarations and for top-level declarations within functions.

-

For specification purposes Environment Record values are values of the Record specification type and can be thought of as existing in a simple object-oriented hierarchy where Environment Record is an abstract class with three concrete subclasses, declarative Environment Record, object Environment Record, and global Environment Record. Function Environment Records and module Environment Records are subclasses of declarative Environment Record. The abstract class includes the abstract specification methods defined in . These abstract methods have distinct concrete algorithms for each of the concrete subclasses.

+ +

Environment Records

+

Environment Record is a specification type used to define the association of |Identifier|s to specific variables and functions, based upon the lexical nesting structure of ECMAScript code. Usually an Environment Record is associated with some specific syntactic structure of ECMAScript code such as a |FunctionDeclaration|, a |BlockStatement|, or a |Catch| clause of a |TryStatement|. Each time such code is evaluated, a new Environment Record is created to record the identifier bindings that are created by that code.

+

Every Environment Record has an [[OuterEnv]] field, which is either *null* or a reference to an outer Environment Record. This is used to model the logical nesting of Environment Record values. The outer reference of an (inner) Environment Record is a reference to the Environment Record that logically surrounds the inner Environment Record. An outer Environment Record may, of course, have its own outer Environment Record. An Environment Record may serve as the outer environment for multiple inner Environment Records. For example, if a |FunctionDeclaration| contains two nested |FunctionDeclaration|s then the Environment Records of each of the nested functions will have as their outer Environment Record the Environment Record of the current evaluation of the surrounding function.

+

Environment Records are purely specification mechanisms and need not correspond to any specific artefact of an ECMAScript implementation. It is impossible for an ECMAScript program to directly access or manipulate such values.

+ + +

The Environment Record Type Hierarchy

+

Environment Records can be thought of as existing in a simple object-oriented hierarchy where Environment Record is an abstract class with three concrete subclasses: declarative Environment Record, object Environment Record, and global Environment Record. Function Environment Records and module Environment Records are subclasses of declarative Environment Record.

+
    +
  • +

    Environment Record (abstract)

    +
      +
    • +

      A declarative Environment Record is used to define the effect of ECMAScript language syntactic elements such as |FunctionDeclaration|s, |VariableDeclaration|s, and |Catch| clauses that directly associate identifier bindings with ECMAScript language values.

      +
        +
      • +

        A function Environment Record corresponds to the invocation of an ECMAScript function object, and contains bindings for the top-level declarations within that function. It may establish a new `this` binding. It also captures the state necessary to support `super` method invocations.

        +
      • +
      • +

        A module Environment Record contains the bindings for the top-level declarations of a |Module|. It also contains the bindings that are explicitly imported by the |Module|. Its [[OuterEnv]] is a global Environment Record.

        +
      • +
      +
    • +
    • +

      An object Environment Record is used to define the effect of ECMAScript elements such as |WithStatement| that associate identifier bindings with the properties of some object.

      +
    • +
    • +

      A global Environment Record is used for |Script| global declarations. It does not have an outer environment; its [[OuterEnv]] is *null*. It may be prepopulated with identifier bindings and it includes an associated global object whose properties provide some of the global environment's identifier bindings. As ECMAScript code is executed, additional properties may be added to the global object and the initial properties may be modified.

      +
    • +
    +
  • +
+ +

The Environment Record abstract class includes the abstract specification methods defined in . These abstract methods have distinct concrete algorithms for each of the concrete subclasses.

@@ -6299,7 +6320,7 @@

Environment Records

Declarative Environment Records

-

Each declarative Environment Record is associated with an ECMAScript program scope containing variable, constant, let, class, module, import, and/or function declarations. A declarative Environment Record binds the set of identifiers defined by the declarations contained within its scope.

+

Each declarative Environment Record is associated with an ECMAScript program scope containing variable, constant, let, class, module, import, and/or function declarations. A declarative Environment Record binds the set of identifiers defined by the declarations contained within its scope.

The behaviour of the concrete specification methods for declarative Environment Records is defined by the following algorithms.

@@ -6420,7 +6441,7 @@

WithBaseObject ( )

Object Environment Records

-

Each object Environment Record is associated with an object called its binding object. An object Environment Record binds the set of string identifier names that directly correspond to the property names of its binding object. Property keys that are not strings in the form of an |IdentifierName| are not included in the set of bound identifiers. Both own and inherited properties are included in the set regardless of the setting of their [[Enumerable]] attribute. Because properties can be dynamically added and deleted from objects, the set of identifiers bound by an object Environment Record may potentially change as a side-effect of any operation that adds or deletes properties. Any bindings that are created as a result of such a side-effect are considered to be a mutable binding even if the Writable attribute of the corresponding property has the value *false*. Immutable bindings do not exist for object Environment Records.

+

Each object Environment Record is associated with an object called its binding object. An object Environment Record binds the set of string identifier names that directly correspond to the property names of its binding object. Property keys that are not strings in the form of an |IdentifierName| are not included in the set of bound identifiers. Both own and inherited properties are included in the set regardless of the setting of their [[Enumerable]] attribute. Because properties can be dynamically added and deleted from objects, the set of identifiers bound by an object Environment Record may potentially change as a side-effect of any operation that adds or deletes properties. Any bindings that are created as a result of such a side-effect are considered to be a mutable binding even if the Writable attribute of the corresponding property has the value *false*. Immutable bindings do not exist for object Environment Records.

Object Environment Records created for `with` statements () can provide their binding object as an implicit *this* value for use in function calls. The capability is controlled by a _withEnvironment_ Boolean value that is associated with each object Environment Record. By default, the value of _withEnvironment_ is *false* for any object Environment Record.

The behaviour of the concrete specification methods for object Environment Records is defined by the following algorithms.

@@ -6533,7 +6554,7 @@

WithBaseObject ( )

- +

Function Environment Records

A function Environment Record is a declarative Environment Record that is used to represent the top-level scope of a function and, if the function is not an |ArrowFunction|, provides a `this` binding. If a function is not an |ArrowFunction| function and references `super`, its function Environment Record also contains the state that is used to perform `super` method invocations from within the function.

Function Environment Records have the additional state fields listed in .

@@ -6701,9 +6722,9 @@

GetSuperBase ( )

- +

Global Environment Records

-

A global Environment Record is used to represent the outer most scope that is shared by all of the ECMAScript |Script| elements that are processed in a common realm. A global Environment Record provides the bindings for built-in globals (clause ), properties of the global object, and for all top-level declarations (, ) that occur within a |Script|.

+

A global Environment Record is used to represent the outer most scope that is shared by all of the ECMAScript |Script| elements that are processed in a common realm. A global Environment Record provides the bindings for built-in globals (clause ), properties of the global object, and for all top-level declarations (, ) that occur within a |Script|.

A global Environment Record is logically a single record but it is specified as a composite encapsulating an object Environment Record and a declarative Environment Record. The object Environment Record has as its base object the global object of the associated Realm Record. This global object is the value returned by the global Environment Record's GetThisBinding concrete method. The object Environment Record component of a global Environment Record contains the bindings for all built-in globals (clause ) and all bindings introduced by a |FunctionDeclaration|, |GeneratorDeclaration|, |AsyncFunctionDeclaration|, |AsyncGeneratorDeclaration|, or |VariableStatement| contained in global code. The bindings for all other ECMAScript declarations in global code are contained in the declarative Environment Record component of the global Environment Record.

Properties may be created directly on a global object. Hence, the object Environment Record component of a global Environment Record may contain both bindings created explicitly by |FunctionDeclaration|, |GeneratorDeclaration|, |AsyncFunctionDeclaration|, |AsyncGeneratorDeclaration|, or |VariableDeclaration| declarations and bindings created implicitly as properties of the global object. In order to identify which bindings were explicitly created using declarations, a global Environment Record maintains a list of the names bound using its CreateGlobalVarBinding and CreateGlobalFunctionBinding concrete methods.

Global Environment Records have the additional fields listed in and the additional methods listed in .

@@ -7084,9 +7105,9 @@

CreateGlobalFunctionBinding ( _N_, _V_, _D_ )

- +

Module Environment Records

-

A module Environment Record is a declarative Environment Record that is used to represent the outer scope of an ECMAScript |Module|. In additional to normal mutable and immutable bindings, module Environment Records also provide immutable import bindings which are bindings that provide indirect access to a target binding that exists in another Environment Record.

+

A module Environment Record is a declarative Environment Record that is used to represent the outer scope of an ECMAScript |Module|. In additional to normal mutable and immutable bindings, module Environment Records also provide immutable import bindings which are bindings that provide indirect access to a target binding that exists in another Environment Record.

Module Environment Records support all of the declarative Environment Record methods listed in and share the same specifications for all of those methods except for GetBindingValue, DeleteBinding, HasThisBinding and GetThisBinding. In addition, module Environment Records support the methods listed in :

@@ -7131,8 +7152,7 @@

GetBindingValue ( _N_, _S_ )

1. Let _M_ and _N2_ be the indirection values provided when this binding for _N_ was created. 1. Let _targetEnv_ be _M_.[[Environment]]. 1. If _targetEnv_ is *undefined*, throw a *ReferenceError* exception. - 1. Let _targetER_ be _targetEnv_'s EnvironmentRecord. - 1. Return ? _targetER_.GetBindingValue(_N2_, *true*). + 1. Return ? _targetEnv_.GetBindingValue(_N2_, *true*). 1. If the binding for _N_ in _envRec_ is an uninitialized binding, throw a *ReferenceError* exception. 1. Return the value currently bound to _N_ in _envRec_. @@ -7182,46 +7202,41 @@

CreateImportBinding ( _N_, _M_, _N2_ )

- -

Lexical Environment Operations

-

The following abstract operations are used in this specification to operate upon lexical environments:

+ +

Environment Record Operations

+

The following abstract operations are used in this specification to operate upon Environment Records:

-

GetIdentifierReference ( _lex_, _name_, _strict_ )

-

The abstract operation GetIdentifierReference takes arguments _lex_ (a Lexical Environment or *null*), _name_ (a String), and _strict_ (a Boolean). It performs the following steps when called:

+

GetIdentifierReference ( _env_, _name_, _strict_ )

+

The abstract operation GetIdentifierReference takes arguments _env_ (an Environment Record or *null*), _name_ (a String), and _strict_ (a Boolean). It performs the following steps when called:

- 1. If _lex_ is the value *null*, then + 1. If _env_ is the value *null*, then 1. Return a value of type Reference whose base value component is *undefined*, whose referenced name component is _name_, and whose strict reference flag is _strict_. - 1. Let _envRec_ be _lex_'s EnvironmentRecord. - 1. Let _exists_ be ? _envRec_.HasBinding(_name_). + 1. Let _exists_ be ? _env_.HasBinding(_name_). 1. If _exists_ is *true*, then - 1. Return a value of type Reference whose base value component is _envRec_, whose referenced name component is _name_, and whose strict reference flag is _strict_. + 1. Return a value of type Reference whose base value component is _env_, whose referenced name component is _name_, and whose strict reference flag is _strict_. 1. Else, - 1. Let _outer_ be the value of _lex_'s outer environment reference. + 1. Let _outer_ be _env_.[[OuterEnv]]. 1. Return ? GetIdentifierReference(_outer_, _name_, _strict_).

NewDeclarativeEnvironment ( _E_ )

-

The abstract operation NewDeclarativeEnvironment takes argument _E_ (a Lexical Environment). It performs the following steps when called:

+

The abstract operation NewDeclarativeEnvironment takes argument _E_ (an Environment Record). It performs the following steps when called:

- 1. Let _env_ be a new Lexical Environment. - 1. Let _envRec_ be a new declarative Environment Record containing no bindings. - 1. Set _env_'s EnvironmentRecord to _envRec_. - 1. Set the outer lexical environment reference of _env_ to _E_. + 1. Let _env_ be a new declarative Environment Record containing no bindings. + 1. Set _env_.[[OuterEnv]] to _E_. 1. Return _env_.

NewObjectEnvironment ( _O_, _E_ )

-

The abstract operation NewObjectEnvironment takes arguments _O_ (an Object) and _E_ (a Lexical Environment). It performs the following steps when called:

+

The abstract operation NewObjectEnvironment takes arguments _O_ (an Object) and _E_ (an Environment Record). It performs the following steps when called:

- 1. Let _env_ be a new Lexical Environment. - 1. Let _envRec_ be a new object Environment Record containing _O_ as the binding object. - 1. Set _env_'s EnvironmentRecord to _envRec_. - 1. Set the outer lexical environment reference of _env_ to _E_. + 1. Let _env_ be a new object Environment Record containing _O_ as the binding object. + 1. Set _env_.[[OuterEnv]] to _E_. 1. Return _env_.
@@ -7232,16 +7247,14 @@

NewFunctionEnvironment ( _F_, _newTarget_ )

1. Assert: _F_ is an ECMAScript function. 1. Assert: Type(_newTarget_) is Undefined or Object. - 1. Let _env_ be a new Lexical Environment. - 1. Let _envRec_ be a new function Environment Record containing no bindings. - 1. Set _envRec_.[[FunctionObject]] to _F_. - 1. If _F_.[[ThisMode]] is ~lexical~, set _envRec_.[[ThisBindingStatus]] to ~lexical~. - 1. Else, set _envRec_.[[ThisBindingStatus]] to ~uninitialized~. + 1. Let _env_ be a new function Environment Record containing no bindings. + 1. Set _env_.[[FunctionObject]] to _F_. + 1. If _F_.[[ThisMode]] is ~lexical~, set _env_.[[ThisBindingStatus]] to ~lexical~. + 1. Else, set _env_.[[ThisBindingStatus]] to ~uninitialized~. 1. Let _home_ be _F_.[[HomeObject]]. - 1. Set _envRec_.[[HomeObject]] to _home_. - 1. Set _envRec_.[[NewTarget]] to _newTarget_. - 1. Set _env_'s EnvironmentRecord to _envRec_. - 1. Set the outer lexical environment reference of _env_ to _F_.[[Environment]]. + 1. Set _env_.[[HomeObject]] to _home_. + 1. Set _env_.[[NewTarget]] to _newTarget_. + 1. Set _env_.[[OuterEnv]] to _F_.[[Environment]]. 1. Return _env_.
@@ -7250,28 +7263,24 @@

NewFunctionEnvironment ( _F_, _newTarget_ )

NewGlobalEnvironment ( _G_, _thisValue_ )

The abstract operation NewGlobalEnvironment takes arguments _G_ and _thisValue_. It performs the following steps when called:

- 1. Let _env_ be a new Lexical Environment. 1. Let _objRec_ be a new object Environment Record containing _G_ as the binding object. 1. Let _dclRec_ be a new declarative Environment Record containing no bindings. - 1. Let _globalRec_ be a new global Environment Record. - 1. Set _globalRec_.[[ObjectRecord]] to _objRec_. - 1. Set _globalRec_.[[GlobalThisValue]] to _thisValue_. - 1. Set _globalRec_.[[DeclarativeRecord]] to _dclRec_. - 1. Set _globalRec_.[[VarNames]] to a new empty List. - 1. Set _env_'s EnvironmentRecord to _globalRec_. - 1. Set the outer lexical environment reference of _env_ to *null*. + 1. Let _env_ be a new global Environment Record. + 1. Set _env_.[[ObjectRecord]] to _objRec_. + 1. Set _env_.[[GlobalThisValue]] to _thisValue_. + 1. Set _env_.[[DeclarativeRecord]] to _dclRec_. + 1. Set _env_.[[VarNames]] to a new empty List. + 1. Set _env_.[[OuterEnv]] to *null*. 1. Return _env_.

NewModuleEnvironment ( _E_ )

-

The abstract operation NewModuleEnvironment takes argument _E_ (a Lexical Environment). It performs the following steps when called:

+

The abstract operation NewModuleEnvironment takes argument _E_ (an Environment Record). It performs the following steps when called:

- 1. Let _env_ be a new Lexical Environment. - 1. Let _envRec_ be a new module Environment Record containing no bindings. - 1. Set _env_'s EnvironmentRecord to _envRec_. - 1. Set the outer lexical environment reference of _env_ to _E_. + 1. Let _env_ be a new module Environment Record containing no bindings. + 1. Set _env_.[[OuterEnv]] to _E_. 1. Return _env_.
@@ -7323,7 +7332,7 @@

Realms

[[GlobalEnv]] @@ -7489,13 +7498,13 @@

Execution Contexts

VariableEnvironment
- Lexical Environment + global Environment Record The global environment for this realm @@ -7481,7 +7490,7 @@

Execution Contexts

LexicalEnvironment
- Identifies the Lexical Environment used to resolve identifier references made by code within this execution context. + Identifies the Environment Record used to resolve identifier references made by code within this execution context.
- Identifies the Lexical Environment whose EnvironmentRecord holds bindings created by |VariableStatement|s within this execution context. + Identifies the Environment Record that holds bindings created by |VariableStatement|s within this execution context.
-

The LexicalEnvironment and VariableEnvironment components of an execution context are always Lexical Environments.

+

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

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

@@ -7535,11 +7544,11 @@

GetActiveScriptOrModule ( )

ResolveBinding ( _name_ [ , _env_ ] )

-

The abstract operation ResolveBinding takes argument _name_ (a String) and optional argument _env_ (a Lexical Environment). It is used to determine the binding of _name_. _env_ can be used to explicitly provide the Lexical Environment that is to be searched for the binding. It performs the following steps when called:

+

The abstract operation ResolveBinding takes argument _name_ (a String) and optional argument _env_ (an Environment Record). It is used to determine the binding of _name_. _env_ can be used to explicitly provide the Environment Record that is to be searched for the binding. It performs the following steps when called:

1. If _env_ is not present or if _env_ is *undefined*, then 1. Set _env_ to the running execution context's LexicalEnvironment. - 1. Assert: _env_ is a Lexical Environment. + 1. Assert: _env_ is an Environment Record. 1. If the code matching the syntactic production that is being evaluated is contained in strict mode code, let _strict_ be *true*; else let _strict_ be *false*. 1. Return ? GetIdentifierReference(_env_, _name_, _strict_). @@ -7552,14 +7561,13 @@

ResolveBinding ( _name_ [ , _env_ ] )

GetThisEnvironment ( )

The abstract operation GetThisEnvironment takes no arguments. It finds the Environment Record that currently supplies the binding of the keyword `this`. It performs the following steps when called:

- 1. Let _lex_ be the running execution context's LexicalEnvironment. + 1. Let _env_ be the running execution context's LexicalEnvironment. 1. Repeat, - 1. Let _envRec_ be _lex_'s EnvironmentRecord. - 1. Let _exists_ be _envRec_.HasThisBinding(). - 1. If _exists_ is *true*, return _envRec_. - 1. Let _outer_ be the value of _lex_'s outer environment reference. + 1. Let _exists_ be _env_.HasThisBinding(). + 1. If _exists_ is *true*, return _env_. + 1. Let _outer_ be _env_.[[OuterEnv]]. 1. Assert: _outer_ is not *null*. - 1. Set _lex_ to _outer_. + 1. Set _env_ to _outer_.

The loop in step 2 will always terminate because the list of environments always ends with the global environment which has a `this` binding.

@@ -8233,10 +8241,10 @@

ECMAScript Function Objects

[[Environment]]
@@ -8407,16 +8415,14 @@

OrdinaryCallBindThis ( _F_, _calleeContext_, _thisArgument_ )

1. Else, 1. If _thisArgument_ is *undefined* or *null*, then 1. Let _globalEnv_ be _calleeRealm_.[[GlobalEnv]]. - 1. Let _globalEnvRec_ be _globalEnv_'s EnvironmentRecord. - 1. Assert: _globalEnvRec_ is a global Environment Record. - 1. Let _thisValue_ be _globalEnvRec_.[[GlobalThisValue]]. + 1. Assert: _globalEnv_ is a global Environment Record. + 1. Let _thisValue_ be _globalEnv_.[[GlobalThisValue]]. 1. Else, 1. Let _thisValue_ be ! ToObject(_thisArgument_). 1. NOTE: ToObject produces wrapper objects using _calleeRealm_. - 1. Let _envRec_ be _localEnv_'s EnvironmentRecord. - 1. Assert: _envRec_ is a function Environment Record. - 1. Assert: The next step never returns an abrupt completion because _envRec_.[[ThisBindingStatus]] is not ~initialized~. - 1. Return _envRec_.BindThisValue(_thisValue_). + 1. Assert: _localEnv_ is a function Environment Record. + 1. Assert: The next step never returns an abrupt completion because _localEnv_.[[ThisBindingStatus]] is not ~initialized~. + 1. Return _localEnv_.BindThisValue(_thisValue_). @@ -8443,7 +8449,6 @@

[[Construct]] ( _argumentsList_, _newTarget_ )

1. Assert: _calleeContext_ is now the running execution context. 1. If _kind_ is ~base~, perform OrdinaryCallBindThis(_F_, _calleeContext_, _thisArgument_). 1. Let _constructorEnv_ be the LexicalEnvironment of _calleeContext_. - 1. Let _envRec_ be _constructorEnv_'s EnvironmentRecord. 1. Let _result_ be OrdinaryCallEvaluateBody(_F_, _argumentsList_). 1. Remove _calleeContext_ from the execution context stack and restore _callerContext_ as the running execution context. 1. If _result_.[[Type]] is ~return~, then @@ -8451,13 +8456,13 @@

[[Construct]] ( _argumentsList_, _newTarget_ )

1. If _kind_ is ~base~, return NormalCompletion(_thisArgument_). 1. If _result_.[[Value]] is not *undefined*, throw a *TypeError* exception. 1. Else, ReturnIfAbrupt(_result_). - 1. Return ? _envRec_.GetThisBinding(). + 1. Return ? _constructorEnv_.GetThisBinding().

OrdinaryFunctionCreate ( _functionPrototype_, _ParameterList_, _Body_, _thisMode_, _Scope_ )

-

The abstract operation OrdinaryFunctionCreate takes arguments _functionPrototype_ (an Object), _ParameterList_ (a Parse Node), _Body_ (a Parse Node), _thisMode_ (either ~lexical-this~ or ~non-lexical-this~), and _Scope_ (a Lexical Environment). It performs the following steps when called:

+

The abstract operation OrdinaryFunctionCreate takes arguments _functionPrototype_ (an Object), _ParameterList_ (a Parse Node), _Body_ (a Parse Node), _thisMode_ (either ~lexical-this~ or ~non-lexical-this~), and _Scope_ (an Environment Record). It performs the following steps when called:

1. Assert: Type(_functionPrototype_) is Object. 1. Let _internalSlotsList_ be the internal slots listed in . @@ -8616,32 +8621,30 @@

FunctionDeclarationInstantiation ( _func_, _argumentsList_ )

1. If _strict_ is *true* or if _hasParameterExpressions_ is *false*, then 1. NOTE: Only a single lexical environment is needed for the parameters and top-level vars. 1. Let _env_ be the LexicalEnvironment of _calleeContext_. - 1. Let _envRec_ be _env_'s EnvironmentRecord. 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 _env_ be NewDeclarativeEnvironment(_calleeEnv_). - 1. Let _envRec_ be _env_'s EnvironmentRecord. 1. Assert: The VariableEnvironment of _calleeContext_ is _calleeEnv_. 1. Set the LexicalEnvironment of _calleeContext_ to _env_. 1. For each String _paramName_ in _parameterNames_, do - 1. Let _alreadyDeclared_ be _envRec_.HasBinding(_paramName_). + 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. 1. If _alreadyDeclared_ is *false*, then - 1. Perform ! _envRec_.CreateMutableBinding(_paramName_, *false*). + 1. Perform ! _env_.CreateMutableBinding(_paramName_, *false*). 1. If _hasDuplicates_ is *true*, then - 1. Perform ! _envRec_.InitializeBinding(_paramName_, *undefined*). + 1. Perform ! _env_.InitializeBinding(_paramName_, *undefined*). 1. If _argumentsObjectNeeded_ is *true*, then 1. If _strict_ is *true* or if _simpleParameterList_ is *false*, then 1. Let _ao_ be CreateUnmappedArgumentsObject(_argumentsList_). 1. Else, 1. NOTE: A mapped argument object is only provided for non-strict functions that don't have a rest parameter, any parameter default value initializers, or any destructured parameters. - 1. Let _ao_ be CreateMappedArgumentsObject(_func_, _formals_, _argumentsList_, _envRec_). + 1. Let _ao_ be CreateMappedArgumentsObject(_func_, _formals_, _argumentsList_, _env_). 1. If _strict_ is *true*, then - 1. Perform ! _envRec_.CreateImmutableBinding(*"arguments"*, *false*). + 1. Perform ! _env_.CreateImmutableBinding(*"arguments"*, *false*). 1. Else, - 1. Perform ! _envRec_.CreateMutableBinding(*"arguments"*, *false*). - 1. Call _envRec_.InitializeBinding(*"arguments"*, _ao_). + 1. Perform ! _env_.CreateMutableBinding(*"arguments"*, *false*). + 1. Call _env_.InitializeBinding(*"arguments"*, _ao_). 1. Let _parameterBindings_ be a new List of _parameterNames_ with *"arguments"* appended. 1. Else, 1. Let _parameterBindings_ be _parameterNames_. @@ -8651,49 +8654,46 @@

FunctionDeclarationInstantiation ( _func_, _argumentsList_ )

1. Else, 1. Perform ? IteratorBindingInitialization for _formals_ with _iteratorRecord_ and _env_ as arguments. 1. If _hasParameterExpressions_ is *false*, then - 1. NOTE: Only a single lexical environment is needed for the parameters and top-level vars. + 1. NOTE: Only a single Environment Record is needed for the parameters and top-level vars. 1. Let _instantiatedVarNames_ be a copy of the List _parameterBindings_. 1. For each _n_ in _varNames_, do 1. If _n_ is not an element of _instantiatedVarNames_, then 1. Append _n_ to _instantiatedVarNames_. - 1. Perform ! _envRec_.CreateMutableBinding(_n_, *false*). - 1. Call _envRec_.InitializeBinding(_n_, *undefined*). + 1. Perform ! _env_.CreateMutableBinding(_n_, *false*). + 1. Call _env_.InitializeBinding(_n_, *undefined*). 1. Let _varEnv_ be _env_. - 1. Let _varEnvRec_ be _envRec_. 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. Let _varEnvRec_ be _varEnv_'s EnvironmentRecord. 1. Set the VariableEnvironment of _calleeContext_ to _varEnv_. 1. Let _instantiatedVarNames_ be a new empty List. 1. For each _n_ in _varNames_, do 1. If _n_ is not an element of _instantiatedVarNames_, then 1. Append _n_ to _instantiatedVarNames_. - 1. Perform ! _varEnvRec_.CreateMutableBinding(_n_, *false*). + 1. Perform ! _varEnv_.CreateMutableBinding(_n_, *false*). 1. If _n_ is not an element of _parameterBindings_ or if _n_ is an element of _functionNames_, let _initialValue_ be *undefined*. 1. Else, - 1. Let _initialValue_ be ! _envRec_.GetBindingValue(_n_, *false*). - 1. Call _varEnvRec_.InitializeBinding(_n_, _initialValue_). + 1. Let _initialValue_ be ! _env_.GetBindingValue(_n_, *false*). + 1. Call _varEnv_.InitializeBinding(_n_, _initialValue_). 1. NOTE: A var with the same name as a formal parameter initially has the same value as the corresponding initialized parameter. 1. NOTE: Annex adds additional steps at this point. 1. If _strict_ is *false*, then 1. Let _lexEnv_ be NewDeclarativeEnvironment(_varEnv_). - 1. NOTE: Non-strict functions use a separate lexical 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. 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, let _lexEnv_ be _varEnv_. - 1. Let _lexEnvRec_ be _lexEnv_'s EnvironmentRecord. 1. Set the LexicalEnvironment of _calleeContext_ to _lexEnv_. 1. Let _lexDeclarations_ be the LexicallyScopedDeclarations of _code_. 1. For each element _d_ in _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. 1. For each element _dn_ of the BoundNames of _d_, do 1. If IsConstantDeclaration of _d_ is *true*, then - 1. Perform ! _lexEnvRec_.CreateImmutableBinding(_dn_, *true*). + 1. Perform ! _lexEnv_.CreateImmutableBinding(_dn_, *true*). 1. Else, - 1. Perform ! _lexEnvRec_.CreateMutableBinding(_dn_, *false*). + 1. Perform ! _lexEnv_.CreateMutableBinding(_dn_, *false*). 1. For each Parse Node _f_ in _functionsToInitialize_, do 1. Let _fn_ be the sole element of the BoundNames of _f_. 1. Let _fo_ be InstantiateFunctionObject of _f_ with argument _lexEnv_. - 1. Perform ! _varEnvRec_.SetMutableBinding(_fn_, _fo_, *false*). + 1. Perform ! _varEnv_.SetMutableBinding(_fn_, _fo_, *false*). 1. Return NormalCompletion(~empty~).
@@ -9611,8 +9611,7 @@

[[Get]] ( _P_, _Receiver_ )

1. Return ? GetModuleNamespace(_targetModule_). 1. Let _targetEnv_ be _targetModule_.[[Environment]]. 1. If _targetEnv_ is *undefined*, throw a *ReferenceError* exception. - 1. Let _targetEnvRec_ be _targetEnv_'s EnvironmentRecord. - 1. Return ? _targetEnvRec_.GetBindingValue(_binding_.[[BindingName]], *true*). + 1. Return ? _targetEnv_.GetBindingValue(_binding_.[[BindingName]], *true*).

ResolveExport is side-effect free. Each time this operation is called with a specific _exportName_, _resolveSet_ pair as arguments it must return the same result. An implementation might choose to pre-compute or cache the ResolveExport results for the [[Exports]] of each module namespace exotic object.

@@ -12317,8 +12316,7 @@

Runtime Semantics: InitializeBoundName ( _name_, _value_, _environment_ ) 1. Assert: Type(_name_) is String. 1. If _environment_ is not *undefined*, then - 1. Let _env_ be the EnvironmentRecord component of _environment_. - 1. Perform _env_.InitializeBinding(_name_, _value_). + 1. Perform _environment_.InitializeBinding(_name_, _value_). 1. Return NormalCompletion(*undefined*). 1. Else, 1. Let _lhs_ be ResolveBinding(_name_). @@ -16305,26 +16303,25 @@

Runtime Semantics: BlockDeclarationInstantiation ( _code_, _env_ )

When a |Block| or |CaseBlock| is evaluated a new declarative Environment Record is created and bindings for each block scoped variable, constant, function, or class declared in the block are instantiated in the Environment Record.

-

The abstract operation BlockDeclarationInstantiation takes arguments _code_ (a Parse Node) and _env_ (a Lexical Environment). _code_ is the Parse Node corresponding to the body of the block. _env_ is the Lexical Environment in which bindings are to be created. It performs the following steps when called:

+

The abstract operation BlockDeclarationInstantiation takes arguments _code_ (a Parse Node) and _env_ (an Environment Record). _code_ is the Parse Node corresponding to the body of the block. _env_ is the Environment Record in which bindings are to be created. It performs the following steps when called:

- 1. Let _envRec_ be _env_'s EnvironmentRecord. - 1. Assert: _envRec_ is a declarative Environment Record. + 1. Assert: _env_ is a declarative Environment Record. 1. Let _declarations_ be the LexicallyScopedDeclarations of _code_. 1. For each element _d_ in _declarations_, do 1. For each element _dn_ of the BoundNames of _d_, do 1. If IsConstantDeclaration of _d_ is *true*, then - 1. Perform ! _envRec_.CreateImmutableBinding(_dn_, *true*). + 1. Perform ! _env_.CreateImmutableBinding(_dn_, *true*). 1. Else, - 1. Perform ! _envRec_.CreateMutableBinding(_dn_, *false*). + 1. Perform ! _env_.CreateMutableBinding(_dn_, *false*). 1. If _d_ is a |FunctionDeclaration|, a |GeneratorDeclaration|, an |AsyncFunctionDeclaration|, or an |AsyncGeneratorDeclaration|, then 1. Let _fn_ be the sole element of the BoundNames of _d_. 1. Let _fo_ be InstantiateFunctionObject of _d_ with argument _env_. - 1. Perform _envRec_.InitializeBinding(_fn_, _fo_). + 1. Perform _env_.InitializeBinding(_fn_, _fo_).
@@ -16335,7 +16332,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 Lexical Environment 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

@@ -16460,7 +16457,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 Lexical Environment 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

@@ -17556,14 +17553,13 @@

Runtime Semantics: LabelledEvaluation

1. Let _oldEnv_ be the running execution context's LexicalEnvironment. 1. Let _loopEnv_ be NewDeclarativeEnvironment(_oldEnv_). - 1. Let _loopEnvRec_ be _loopEnv_'s EnvironmentRecord. 1. Let _isConst_ be IsConstantDeclaration of |LexicalDeclaration|. 1. Let _boundNames_ be the BoundNames of |LexicalDeclaration|. 1. For each element _dn_ of _boundNames_, do 1. If _isConst_ is *true*, then - 1. Perform ! _loopEnvRec_.CreateImmutableBinding(_dn_, *true*). + 1. Perform ! _loopEnv_.CreateImmutableBinding(_dn_, *true*). 1. Else, - 1. Perform ! _loopEnvRec_.CreateMutableBinding(_dn_, *false*). + 1. Perform ! _loopEnv_.CreateMutableBinding(_dn_, *false*). 1. Set the running execution context's LexicalEnvironment to _loopEnv_. 1. Let _forDcl_ be the result of evaluating |LexicalDeclaration|. 1. If _forDcl_ is an abrupt completion, then @@ -17603,15 +17599,13 @@

Runtime Semantics: CreatePerIterationEnvironment ( _perIterationBindings_ )< 1. If _perIterationBindings_ has any elements, then 1. Let _lastIterationEnv_ be the running execution context's LexicalEnvironment. - 1. Let _lastIterationEnvRec_ be _lastIterationEnv_'s EnvironmentRecord. - 1. Let _outer_ be _lastIterationEnv_'s outer environment reference. + 1. Let _outer_ be _lastIterationEnv_.[[OuterEnv]]. 1. Assert: _outer_ is not *null*. 1. Let _thisIterationEnv_ be NewDeclarativeEnvironment(_outer_). - 1. Let _thisIterationEnvRec_ be _thisIterationEnv_'s EnvironmentRecord. 1. For each element _bn_ of _perIterationBindings_, do - 1. Perform ! _thisIterationEnvRec_.CreateMutableBinding(_bn_, *false*). - 1. Let _lastValue_ be ? _lastIterationEnvRec_.GetBindingValue(_bn_, *true*). - 1. Perform _thisIterationEnvRec_.InitializeBinding(_bn_, _lastValue_). + 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. Return *undefined*. @@ -17844,13 +17838,12 @@

Runtime Semantics: BindingInstantiation

With parameter _environment_.

ForDeclaration : LetOrConst ForBinding - 1. Let _envRec_ be _environment_'s EnvironmentRecord. - 1. Assert: _envRec_ is a declarative Environment Record. + 1. Assert: _environment_ is a declarative Environment Record. 1. For each element _name_ of the BoundNames of |ForBinding|, do 1. If IsConstantDeclaration of |LetOrConst| is *true*, then - 1. Perform ! _envRec_.CreateImmutableBinding(_name_, *true*). + 1. Perform ! _environment_.CreateImmutableBinding(_name_, *true*). 1. Else, - 1. Perform ! _envRec_.CreateMutableBinding(_name_, *false*). + 1. Perform ! _environment_.CreateMutableBinding(_name_, *false*).
@@ -17922,9 +17915,8 @@

Runtime Semantics: ForIn/OfHeadEvaluation ( _uninitializedBoundNames_, _expr 1. If _uninitializedBoundNames_ is not an empty List, then 1. Assert: _uninitializedBoundNames_ has no duplicate entries. 1. Let _newEnv_ be NewDeclarativeEnvironment(_oldEnv_). - 1. Let _newEnvRec_ be _newEnv_'s EnvironmentRecord. 1. For each string _name_ in _uninitializedBoundNames_, do - 1. Perform ! _newEnvRec_.CreateMutableBinding(_name_, *false*). + 1. Perform ! _newEnv_.CreateMutableBinding(_name_, *false*). 1. Set the running execution context's LexicalEnvironment to _newEnv_. 1. Let _exprRef_ be the result of evaluating _expr_. 1. Set the running execution context's LexicalEnvironment to _oldEnv_. @@ -18390,7 +18382,7 @@

Runtime Semantics: Evaluation

1. Let _obj_ be ? ToObject(? GetValue(_val_)). 1. Let _oldEnv_ be the running execution context's LexicalEnvironment. 1. Let _newEnv_ be NewObjectEnvironment(_obj_, _oldEnv_). - 1. Set the _withEnvironment_ flag of _newEnv_'s EnvironmentRecord to *true*. + 1. Set the _withEnvironment_ flag of _newEnv_ to *true*. 1. Set the running execution context's LexicalEnvironment to _newEnv_. 1. Let _C_ be the result of evaluating |Statement|. 1. Set the running execution context's LexicalEnvironment to _oldEnv_. @@ -19263,9 +19255,8 @@

Runtime Semantics: CatchClauseEvaluation

1. Let _oldEnv_ be the running execution context's LexicalEnvironment. 1. Let _catchEnv_ be NewDeclarativeEnvironment(_oldEnv_). - 1. Let _catchEnvRec_ be _catchEnv_'s EnvironmentRecord. 1. For each element _argName_ of the BoundNames of |CatchParameter|, do - 1. Perform ! _catchEnvRec_.CreateMutableBinding(_argName_, *false*). + 1. Perform ! _catchEnv_.CreateMutableBinding(_argName_, *false*). 1. Set the running execution context's LexicalEnvironment to _catchEnv_. 1. Let _status_ be BindingInitialization of |CatchParameter| with arguments _thrownValue_ and _catchEnv_. 1. If _status_ is an abrupt completion, then @@ -19842,14 +19833,13 @@

Runtime Semantics: Evaluation

1. Let _scope_ be the running execution context's LexicalEnvironment. 1. Let _funcEnv_ be NewDeclarativeEnvironment(_scope_). - 1. Let _envRec_ be _funcEnv_'s EnvironmentRecord. 1. Let _name_ be StringValue of |BindingIdentifier|. - 1. Perform _envRec_.CreateImmutableBinding(_name_, *false*). + 1. Perform _funcEnv_.CreateImmutableBinding(_name_, *false*). 1. Let _closure_ be OrdinaryFunctionCreate(%Function.prototype%, |FormalParameters|, |FunctionBody|, ~non-lexical-this~, _funcEnv_). 1. Perform SetFunctionName(_closure_, _name_). 1. Perform MakeConstructor(_closure_). 1. Set _closure_.[[SourceText]] to the source text matched by |FunctionExpression|. - 1. Perform _envRec_.InitializeBinding(_name_, _closure_). + 1. Perform _funcEnv_.InitializeBinding(_name_, _closure_). 1. Return _closure_. @@ -20588,14 +20578,13 @@

Runtime Semantics: Evaluation

1. Let _scope_ be the running execution context's LexicalEnvironment. 1. Let _funcEnv_ be NewDeclarativeEnvironment(_scope_). - 1. Let _envRec_ be _funcEnv_'s EnvironmentRecord. 1. Let _name_ be StringValue of |BindingIdentifier|. - 1. Perform _envRec_.CreateImmutableBinding(_name_, *false*). + 1. Perform _funcEnv_.CreateImmutableBinding(_name_, *false*). 1. Let _closure_ be OrdinaryFunctionCreate(%Generator%, |FormalParameters|, |GeneratorBody|, ~non-lexical-this~, _funcEnv_). 1. Perform SetFunctionName(_closure_, _name_). 1. Let _prototype_ be OrdinaryObjectCreate(%Generator.prototype%). 1. Perform DefinePropertyOrThrow(_closure_, *"prototype"*, PropertyDescriptor { [[Value]]: _prototype_, [[Writable]]: *true*, [[Enumerable]]: *false*, [[Configurable]]: *false* }). - 1. Perform _envRec_.InitializeBinding(_name_, _closure_). + 1. Perform _funcEnv_.InitializeBinding(_name_, _closure_). 1. Set _closure_.[[SourceText]] to the source text matched by |GeneratorExpression|. 1. Return _closure_. @@ -20926,14 +20915,13 @@

Runtime Semantics: Evaluation

1. Let _scope_ be the running execution context's LexicalEnvironment. 1. Let _funcEnv_ be ! NewDeclarativeEnvironment(_scope_). - 1. Let _envRec_ be _funcEnv_'s EnvironmentRecord. 1. Let _name_ be StringValue of |BindingIdentifier|. - 1. Perform ! _envRec_.CreateImmutableBinding(_name_, *false*). + 1. Perform ! _funcEnv_.CreateImmutableBinding(_name_, *false*). 1. Let _closure_ be ! OrdinaryFunctionCreate(%AsyncGenerator%, |FormalParameters|, |AsyncGeneratorBody|, ~non-lexical-this~, _funcEnv_). 1. Perform ! SetFunctionName(_closure_, _name_). 1. Let _prototype_ be ! OrdinaryObjectCreate(%AsyncGenerator.prototype%). 1. Perform ! DefinePropertyOrThrow(_closure_, *"prototype"*, PropertyDescriptor { [[Value]]: _prototype_, [[Writable]]: *true*, [[Enumerable]]: *false*, [[Configurable]]: *false* }). - 1. Perform ! _envRec_.InitializeBinding(_name_, _closure_). + 1. Perform ! _funcEnv_.InitializeBinding(_name_, _closure_). 1. Set _closure_.[[SourceText]] to the source text matched by |AsyncGeneratorExpression|. 1. Return _closure_. @@ -21198,18 +21186,17 @@

Runtime Semantics: ClassDefinitionEvaluation

With parameters _classBinding_ and _className_.

ClassTail : ClassHeritage? `{` ClassBody? `}` - 1. Let _lex_ be the LexicalEnvironment of the running execution context. - 1. Let _classScope_ be NewDeclarativeEnvironment(_lex_). - 1. Let _classScopeEnvRec_ be _classScope_'s EnvironmentRecord. + 1. Let _env_ be the LexicalEnvironment of the running execution context. + 1. Let _classScope_ be NewDeclarativeEnvironment(_env_). 1. If _classBinding_ is not *undefined*, then - 1. Perform _classScopeEnvRec_.CreateImmutableBinding(_classBinding_, *true*). + 1. Perform _classScope_.CreateImmutableBinding(_classBinding_, *true*). 1. If |ClassHeritage_opt| is not present, then 1. Let _protoParent_ be %Object.prototype%. 1. Let _constructorParent_ be %Function.prototype%. 1. Else, 1. Set the running execution context's LexicalEnvironment to _classScope_. 1. Let _superclassRef_ be the result of evaluating |ClassHeritage|. - 1. Set the running execution context's LexicalEnvironment to _lex_. + 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*. @@ -21247,11 +21234,11 @@

Runtime Semantics: ClassDefinitionEvaluation

1. Else, 1. Let _status_ be PropertyDefinitionEvaluation of _m_ with arguments _F_ and *false*. 1. If _status_ is an abrupt completion, then - 1. Set the running execution context's LexicalEnvironment to _lex_. + 1. Set the running execution context's LexicalEnvironment to _env_. 1. Return Completion(_status_). - 1. Set the running execution context's LexicalEnvironment to _lex_. + 1. Set the running execution context's LexicalEnvironment to _env_. 1. If _classBinding_ is not *undefined*, then - 1. Perform _classScopeEnvRec_.InitializeBinding(_classBinding_, _F_). + 1. Perform _classScope_.InitializeBinding(_classBinding_, _F_). 1. Return _F_.
@@ -21598,12 +21585,11 @@

Runtime Semantics: Evaluation

1. Let _scope_ be the LexicalEnvironment of the running execution context. 1. Let _funcEnv_ be ! NewDeclarativeEnvironment(_scope_). - 1. Let _envRec_ be _funcEnv_'s EnvironmentRecord. 1. Let _name_ be StringValue of |BindingIdentifier|. - 1. Perform ! _envRec_.CreateImmutableBinding(_name_, *false*). + 1. Perform ! _funcEnv_.CreateImmutableBinding(_name_, *false*). 1. Let _closure_ be ! OrdinaryFunctionCreate(%AsyncFunction.prototype%, |FormalParameters|, |AsyncFunctionBody|, ~non-lexical-this~, _funcEnv_). 1. Perform ! SetFunctionName(_closure_, _name_). - 1. Perform ! _envRec_.InitializeBinding(_name_, _closure_). + 1. Perform ! _funcEnv_.InitializeBinding(_name_, _closure_). 1. Set _closure_.[[SourceText]] to the source text matched by |AsyncFunctionExpression|. 1. Return _closure_. @@ -22378,10 +22364,10 @@

Script Records

[[Environment]] @@ -22459,24 +22445,23 @@

Runtime Semantics: GlobalDeclarationInstantiation ( _script_, _env_ )

When an execution context is established for evaluating scripts, declarations are instantiated in the current global environment. Each global binding declared in the code is instantiated.

-

The abstract operation GlobalDeclarationInstantiation takes arguments _script_ (a Parse Node for |ScriptBody|) and _env_ (a Lexical Environment). _script_ is the |ScriptBody| for which the execution context is being established. _env_ is the global lexical environment in which bindings are to be created. It performs the following steps when called:

+

The abstract operation GlobalDeclarationInstantiation takes arguments _script_ (a Parse Node for |ScriptBody|) and _env_ (an Environment Record). _script_ is the |ScriptBody| for which the execution context is being established. _env_ is the global environment in which bindings are to be created. It performs the following steps when called:

- 1. Let _envRec_ be _env_'s EnvironmentRecord. - 1. Assert: _envRec_ is a global Environment Record. + 1. Assert: _env_ is a global Environment Record. 1. Let _lexNames_ be the LexicallyDeclaredNames of _script_. 1. Let _varNames_ be the VarDeclaredNames of _script_. 1. For each _name_ in _lexNames_, do - 1. If _envRec_.HasVarDeclaration(_name_) is *true*, throw a *SyntaxError* exception. - 1. If _envRec_.HasLexicalDeclaration(_name_) is *true*, throw a *SyntaxError* exception. - 1. Let _hasRestrictedGlobal_ be ? _envRec_.HasRestrictedGlobalProperty(_name_). + 1. If _env_.HasVarDeclaration(_name_) is *true*, throw a *SyntaxError* exception. + 1. If _env_.HasLexicalDeclaration(_name_) is *true*, throw a *SyntaxError* exception. + 1. Let _hasRestrictedGlobal_ be ? _env_.HasRestrictedGlobalProperty(_name_). 1. If _hasRestrictedGlobal_ is *true*, throw a *SyntaxError* exception. 1. For each _name_ in _varNames_, do - 1. If _envRec_.HasLexicalDeclaration(_name_) is *true*, throw a *SyntaxError* exception. + 1. If _env_.HasLexicalDeclaration(_name_) is *true*, throw a *SyntaxError* exception. 1. Let _varDeclarations_ be the VarScopedDeclarations of _script_. 1. Let _functionsToInitialize_ be a new empty List. 1. Let _declaredFunctionNames_ be a new empty List. @@ -22486,7 +22471,7 @@

Runtime Semantics: GlobalDeclarationInstantiation ( _script_, _env_ )

1. NOTE: If there are multiple function declarations for the same name, the last declaration is used. 1. Let _fn_ be the sole element of the BoundNames of _d_. 1. If _fn_ is not an element of _declaredFunctionNames_, then - 1. Let _fnDefinable_ be ? _envRec_.CanDeclareGlobalFunction(_fn_). + 1. Let _fnDefinable_ be ? _env_.CanDeclareGlobalFunction(_fn_). 1. If _fnDefinable_ is *false*, throw a *TypeError* exception. 1. Append _fn_ to _declaredFunctionNames_. 1. Insert _d_ as the first element of _functionsToInitialize_. @@ -22495,7 +22480,7 @@

Runtime Semantics: GlobalDeclarationInstantiation ( _script_, _env_ )

1. If _d_ is a |VariableDeclaration|, a |ForBinding|, or a |BindingIdentifier|, then 1. For each String _vn_ in the BoundNames of _d_, do 1. If _vn_ is not an element of _declaredFunctionNames_, then - 1. Let _vnDefinable_ be ? _envRec_.CanDeclareGlobalVar(_vn_). + 1. Let _vnDefinable_ be ? _env_.CanDeclareGlobalVar(_vn_). 1. If _vnDefinable_ is *false*, throw a *TypeError* exception. 1. If _vn_ is not an element of _declaredVarNames_, then 1. Append _vn_ to _declaredVarNames_. @@ -22506,15 +22491,15 @@

Runtime Semantics: GlobalDeclarationInstantiation ( _script_, _env_ )

1. NOTE: Lexically declared names are only instantiated here but not initialized. 1. For each element _dn_ of the BoundNames of _d_, do 1. If IsConstantDeclaration of _d_ is *true*, then - 1. Perform ? _envRec_.CreateImmutableBinding(_dn_, *true*). + 1. Perform ? _env_.CreateImmutableBinding(_dn_, *true*). 1. Else, - 1. Perform ? _envRec_.CreateMutableBinding(_dn_, *false*). + 1. Perform ? _env_.CreateMutableBinding(_dn_, *false*). 1. For each Parse Node _f_ in _functionsToInitialize_, do 1. Let _fn_ be the sole element of the BoundNames of _f_. 1. Let _fo_ be InstantiateFunctionObject of _f_ with argument _env_. - 1. Perform ? _envRec_.CreateGlobalFunctionBinding(_fn_, _fo_, *false*). + 1. Perform ? _env_.CreateGlobalFunctionBinding(_fn_, _fo_, *false*). 1. For each String _vn_ in _declaredVarNames_, in list order, do - 1. Perform ? _envRec_.CreateGlobalVarBinding(_vn_, *false*). + 1. Perform ? _env_.CreateGlobalVarBinding(_vn_, *false*). 1. Return NormalCompletion(~empty~).
@@ -22907,10 +22892,10 @@

Abstract Module Records

[[Environment]]
@@ -23082,7 +23067,7 @@

Cyclic Module Records

InitializeEnvironment() @@ -23912,23 +23897,22 @@

InitializeEnvironment ( ) Concrete Method

1. Assert: _realm_ is not *undefined*. 1. Let _env_ be NewModuleEnvironment(_realm_.[[GlobalEnv]]). 1. Set _module_.[[Environment]] to _env_. - 1. Let _envRec_ be _env_'s EnvironmentRecord. 1. For each ImportEntry Record _in_ in _module_.[[ImportEntries]], do 1. Let _importedModule_ be ! HostResolveImportedModule(_module_, _in_.[[ModuleRequest]]). 1. NOTE: The above call cannot fail because imported module requests are a subset of _module_.[[RequestedModules]], and these have been resolved earlier in this algorithm. 1. If _in_.[[ImportName]] is *"\*"*, then 1. Let _namespace_ be ? GetModuleNamespace(_importedModule_). - 1. Perform ! _envRec_.CreateImmutableBinding(_in_.[[LocalName]], *true*). - 1. Call _envRec_.InitializeBinding(_in_.[[LocalName]], _namespace_). + 1. Perform ! _env_.CreateImmutableBinding(_in_.[[LocalName]], *true*). + 1. Call _env_.InitializeBinding(_in_.[[LocalName]], _namespace_). 1. Else, 1. Let _resolution_ be ? _importedModule_.ResolveExport(_in_.[[ImportName]]). 1. If _resolution_ is *null* or *"ambiguous"*, throw a *SyntaxError* exception. 1. If _resolution_.[[BindingName]] is *"\*namespace\*"*, then 1. Let _namespace_ be ? GetModuleNamespace(_resolution_.[[Module]]). - 1. Perform ! _envRec_.CreateImmutableBinding(_in_.[[LocalName]], *true*). - 1. Call _envRec_.InitializeBinding(_in_.[[LocalName]], _namespace_). + 1. Perform ! _env_.CreateImmutableBinding(_in_.[[LocalName]], *true*). + 1. Call _env_.InitializeBinding(_in_.[[LocalName]], _namespace_). 1. Else, - 1. Call _envRec_.CreateImportBinding(_in_.[[LocalName]], _resolution_.[[Module]], _resolution_.[[BindingName]]). + 1. Call _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. Assert: _module_.[[Realm]] is not *undefined*. @@ -23944,19 +23928,19 @@

InitializeEnvironment ( ) Concrete Method

1. For each element _d_ in _varDeclarations_, do 1. For each element _dn_ of the BoundNames of _d_, do 1. If _dn_ is not an element of _declaredVarNames_, then - 1. Perform ! _envRec_.CreateMutableBinding(_dn_, *false*). - 1. Call _envRec_.InitializeBinding(_dn_, *undefined*). + 1. Perform ! _env_.CreateMutableBinding(_dn_, *false*). + 1. Call _env_.InitializeBinding(_dn_, *undefined*). 1. Append _dn_ to _declaredVarNames_. 1. Let _lexDeclarations_ be the LexicallyScopedDeclarations of _code_. 1. For each element _d_ in _lexDeclarations_, do 1. For each element _dn_ of the BoundNames of _d_, do 1. If IsConstantDeclaration of _d_ is *true*, then - 1. Perform ! _envRec_.CreateImmutableBinding(_dn_, *true*). + 1. Perform ! _env_.CreateImmutableBinding(_dn_, *true*). 1. Else, - 1. Perform ! _envRec_.CreateMutableBinding(_dn_, *false*). + 1. Perform ! _env_.CreateMutableBinding(_dn_, *false*). 1. If _d_ is a |FunctionDeclaration|, a |GeneratorDeclaration|, an |AsyncFunctionDeclaration|, or an |AsyncGeneratorDeclaration|, then 1. Let _fo_ be InstantiateFunctionObject of _d_ with argument _env_. - 1. Call _envRec_.InitializeBinding(_dn_, _fo_). + 1. Call _env_.InitializeBinding(_dn_, _fo_). 1. Remove _moduleContext_ from the execution context stack. 1. Return NormalCompletion(~empty~). @@ -24785,7 +24769,7 @@

Forbidden Extensions

ECMAScript Standard Built-in Objects

-

There are certain built-in objects available whenever an ECMAScript |Script| or |Module| begins execution. One, the global object, is part of the lexical environment of the executing program. Others are accessible as initial properties of the global object or indirectly as properties of accessible built-in objects.

+

There are certain built-in objects available whenever an ECMAScript |Script| or |Module| begins execution. One, the global object, is part of the global environment of the executing program. Others are accessible as initial properties of the global object or indirectly as properties of accessible built-in objects.

Unless specified otherwise, a built-in object that is callable as a function is a built-in function object with the characteristics described in . Unless specified otherwise, the [[Extensible]] internal slot of a built-in object initially has the value *true*. Every built-in function object has a [[Realm]] internal slot whose value is the Realm Record of the realm for which the object was initially created.

Many built-in objects are functions: they can be invoked with arguments. Some of them furthermore are constructors: they are functions intended for use with the `new` operator. For each built-in function, this specification describes the arguments required by that function and the properties of that function object. For each built-in constructor, this specification furthermore describes properties of the prototype object of that constructor and properties of specific object instances returned by a `new` expression that invokes that constructor.

Unless otherwise specified in the description of a particular function, if a built-in function or constructor is given fewer arguments than the function is specified to require, the function or constructor shall behave exactly as if it had been given sufficient additional arguments, each such argument being the *undefined* value. Such missing arguments are considered to be “not present” and may be identified in that manner by specification algorithms. In the description of a particular function, the terms “*this* value” and “NewTarget” have the meanings given in .

@@ -24824,7 +24808,7 @@

Value Properties of the Global Object

globalThis

-

The initial value of the *"globalThis"* property of the global object in a Realm Record _realm_ is _realm_.[[GlobalEnv]]'s EnvironmentRecord's [[GlobalThisValue]].

+

The initial value of the *"globalThis"* property of the global object in a Realm Record _realm_ is _realm_.[[GlobalEnv]].[[GlobalThisValue]].

This property has the attributes { [[Writable]]: *true*, [[Enumerable]]: *false*, [[Configurable]]: *true* }.

@@ -24935,25 +24919,22 @@

Runtime Semantics: EvalDeclarationInstantiation ( _body_, _varEnv_, _lexEnv_ 1. Let _varNames_ be the VarDeclaredNames of _body_. 1. Let _varDeclarations_ be the VarScopedDeclarations of _body_. - 1. Let _lexEnvRec_ be _lexEnv_'s EnvironmentRecord. - 1. Let _varEnvRec_ be _varEnv_'s EnvironmentRecord. 1. If _strict_ is *false*, then - 1. If _varEnvRec_ is a global Environment Record, then + 1. If _varEnv_ is a global Environment Record, then 1. For each _name_ in _varNames_, do - 1. If _varEnvRec_.HasLexicalDeclaration(_name_) is *true*, throw a *SyntaxError* exception. + 1. If _varEnv_.HasLexicalDeclaration(_name_) is *true*, throw a *SyntaxError* exception. 1. NOTE: `eval` will not create a global var declaration that would be shadowed by a global lexical declaration. - 1. Let _thisLex_ be _lexEnv_. + 1. Let _thisEnv_ be _lexEnv_. 1. Assert: The following loop will terminate. - 1. Repeat, while _thisLex_ is not the same as _varEnv_, - 1. Let _thisEnvRec_ be _thisLex_'s EnvironmentRecord. - 1. If _thisEnvRec_ is not an object Environment Record, then + 1. Repeat, while _thisEnv_ is not the same as _varEnv_, + 1. If _thisEnv_ is not an object Environment Record, then 1. NOTE: The environment of with statements cannot contain any lexical declaration so it doesn't need to be checked for var/let hoisting conflicts. 1. For each _name_ in _varNames_, do - 1. If _thisEnvRec_.HasBinding(_name_) is *true*, then + 1. If _thisEnv_.HasBinding(_name_) is *true*, then 1. Throw a *SyntaxError* exception. 1. NOTE: Annex defines alternate semantics for the above step. 1. NOTE: A direct eval will not hoist var declaration over a like-named lexical declaration. - 1. Set _thisLex_ to _thisLex_'s outer environment reference. + 1. Set _thisEnv_ to _thisEnv_.[[OuterEnv]]. 1. Let _functionsToInitialize_ be a new empty List. 1. Let _declaredFunctionNames_ be a new empty List. 1. For each _d_ in _varDeclarations_, in reverse list order, do @@ -24962,8 +24943,8 @@

Runtime Semantics: EvalDeclarationInstantiation ( _body_, _varEnv_, _lexEnv_ 1. NOTE: If there are multiple function declarations for the same name, the last declaration is used. 1. Let _fn_ be the sole element of the BoundNames of _d_. 1. If _fn_ is not an element of _declaredFunctionNames_, then - 1. If _varEnvRec_ is a global Environment Record, then - 1. Let _fnDefinable_ be ? _varEnvRec_.CanDeclareGlobalFunction(_fn_). + 1. If _varEnv_ is a global Environment Record, then + 1. Let _fnDefinable_ be ? _varEnv_.CanDeclareGlobalFunction(_fn_). 1. If _fnDefinable_ is *false*, throw a *TypeError* exception. 1. Append _fn_ to _declaredFunctionNames_. 1. Insert _d_ as the first element of _functionsToInitialize_. @@ -24973,42 +24954,42 @@

Runtime Semantics: EvalDeclarationInstantiation ( _body_, _varEnv_, _lexEnv_ 1. If _d_ is a |VariableDeclaration|, a |ForBinding|, or a |BindingIdentifier|, then 1. For each String _vn_ in the BoundNames of _d_, do 1. If _vn_ is not an element of _declaredFunctionNames_, then - 1. If _varEnvRec_ is a global Environment Record, then - 1. Let _vnDefinable_ be ? _varEnvRec_.CanDeclareGlobalVar(_vn_). + 1. If _varEnv_ is a global Environment Record, then + 1. Let _vnDefinable_ be ? _varEnv_.CanDeclareGlobalVar(_vn_). 1. If _vnDefinable_ is *false*, throw a *TypeError* exception. 1. If _vn_ is not an element of _declaredVarNames_, then 1. Append _vn_ to _declaredVarNames_. - 1. NOTE: No abnormal terminations occur after this algorithm step unless _varEnvRec_ is a global Environment Record and the global object is a Proxy exotic object. + 1. NOTE: No abnormal terminations occur after this algorithm step unless _varEnv_ is a global Environment Record and the global object is a Proxy exotic object. 1. Let _lexDeclarations_ be the LexicallyScopedDeclarations of _body_. 1. For each element _d_ in _lexDeclarations_, do 1. NOTE: Lexically declared names are only instantiated here but not initialized. 1. For each element _dn_ of the BoundNames of _d_, do 1. If IsConstantDeclaration of _d_ is *true*, then - 1. Perform ? _lexEnvRec_.CreateImmutableBinding(_dn_, *true*). + 1. Perform ? _lexEnv_.CreateImmutableBinding(_dn_, *true*). 1. Else, - 1. Perform ? _lexEnvRec_.CreateMutableBinding(_dn_, *false*). + 1. Perform ? _lexEnv_.CreateMutableBinding(_dn_, *false*). 1. For each Parse Node _f_ in _functionsToInitialize_, do 1. Let _fn_ be the sole element of the BoundNames of _f_. 1. Let _fo_ be InstantiateFunctionObject of _f_ with argument _lexEnv_. - 1. If _varEnvRec_ is a global Environment Record, then - 1. Perform ? _varEnvRec_.CreateGlobalFunctionBinding(_fn_, _fo_, *true*). + 1. If _varEnv_ is a global Environment Record, then + 1. Perform ? _varEnv_.CreateGlobalFunctionBinding(_fn_, _fo_, *true*). 1. Else, - 1. Let _bindingExists_ be _varEnvRec_.HasBinding(_fn_). + 1. Let _bindingExists_ be _varEnv_.HasBinding(_fn_). 1. If _bindingExists_ is *false*, then - 1. Let _status_ be ! _varEnvRec_.CreateMutableBinding(_fn_, *true*). - 1. Assert: _status_ is not an abrupt completion because of validation preceding step 12. - 1. Perform ! _varEnvRec_.InitializeBinding(_fn_, _fo_). + 1. Let _status_ be ! _varEnv_.CreateMutableBinding(_fn_, *true*). + 1. Assert: _status_ is not an abrupt completion because of validation preceding step 10. + 1. Perform ! _varEnv_.InitializeBinding(_fn_, _fo_). 1. Else, - 1. Perform ! _varEnvRec_.SetMutableBinding(_fn_, _fo_, *false*). + 1. Perform ! _varEnv_.SetMutableBinding(_fn_, _fo_, *false*). 1. For each String _vn_ in _declaredVarNames_, in list order, do - 1. If _varEnvRec_ is a global Environment Record, then - 1. Perform ? _varEnvRec_.CreateGlobalVarBinding(_vn_, *true*). + 1. If _varEnv_ is a global Environment Record, then + 1. Perform ? _varEnv_.CreateGlobalVarBinding(_vn_, *true*). 1. Else, - 1. Let _bindingExists_ be _varEnvRec_.HasBinding(_vn_). + 1. Let _bindingExists_ be _varEnv_.HasBinding(_vn_). 1. If _bindingExists_ is *false*, then - 1. Let _status_ be ! _varEnvRec_.CreateMutableBinding(_vn_, *true*). - 1. Assert: _status_ is not an abrupt completion because of validation preceding step 12. - 1. Perform ! _varEnvRec_.InitializeBinding(_vn_, *undefined*). + 1. Let _status_ be ! _varEnv_.CreateMutableBinding(_vn_, *true*). + 1. Assert: _status_ is not an abrupt completion because of validation preceding step 10. + 1. Perform ! _varEnv_.InitializeBinding(_vn_, *undefined*). 1. Return NormalCompletion(~empty~). @@ -42924,22 +42905,20 @@

Changes to FunctionDeclarationInstantiation

1. If replacing the |FunctionDeclaration| _f_ with a |VariableStatement| that has _F_ as a |BindingIdentifier| would not produce any Early Errors for _func_ and _F_ is not an element of _parameterNames_, then 1. NOTE: A var binding for _F_ is only instantiated here if it is neither a VarDeclaredName, the name of a formal parameter, or another |FunctionDeclaration|. 1. If _initializedBindings_ does not contain _F_ and _F_ is not *"arguments"*, then - 1. Perform ! _varEnvRec_.CreateMutableBinding(_F_, *false*). - 1. Perform _varEnvRec_.InitializeBinding(_F_, *undefined*). + 1. Perform ! _varEnv_.CreateMutableBinding(_F_, *false*). + 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 _fenvRec_ be _fenv_'s EnvironmentRecord. 1. Let _benv_ be the running execution context's LexicalEnvironment. - 1. Let _benvRec_ be _benv_'s EnvironmentRecord. - 1. Let _fobj_ be ! _benvRec_.GetBindingValue(_F_, *false*). - 1. Perform ! _fenvRec_.SetMutableBinding(_F_, _fobj_, *false*). + 1. Let _fobj_ be ! _benv_.GetBindingValue(_F_, *false*). + 1. Perform ! _fenv_.SetMutableBinding(_F_, _fobj_, *false*). 1. Return NormalCompletion(~empty~).

Changes to GlobalDeclarationInstantiation

-

During GlobalDeclarationInstantiation the following steps are performed in place of step 14:

+

During GlobalDeclarationInstantiation the following steps are performed in place of step 13:

1. Let _strict_ be IsStrict of _script_. 1. If _strict_ is *false*, then @@ -42949,26 +42928,24 @@

Changes to GlobalDeclarationInstantiation

1. For each |FunctionDeclaration| _f_ that is directly contained in the |StatementList| of a |Block|, |CaseClause|, or |DefaultClause| Contained within _script_, do 1. Let _F_ be StringValue of the |BindingIdentifier| of _f_. 1. If replacing the |FunctionDeclaration| _f_ with a |VariableStatement| that has _F_ as a |BindingIdentifier| would not produce any Early Errors for _script_, then - 1. If _envRec_.HasLexicalDeclaration(_F_) is *false*, then - 1. Let _fnDefinable_ be ? _envRec_.CanDeclareGlobalVar(_F_). + 1. If _env_.HasLexicalDeclaration(_F_) is *false*, then + 1. Let _fnDefinable_ be ? _env_.CanDeclareGlobalVar(_F_). 1. If _fnDefinable_ is *true*, then 1. NOTE: A var binding for _F_ is only instantiated here if it is neither a VarDeclaredName nor the name of another |FunctionDeclaration|. 1. If _declaredFunctionOrVarNames_ does not contain _F_, then - 1. Perform ? _envRec_.CreateGlobalVarBinding(_F_, *false*). + 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 _genvRec_ be _genv_'s EnvironmentRecord. 1. Let _benv_ be the running execution context's LexicalEnvironment. - 1. Let _benvRec_ be _benv_'s EnvironmentRecord. - 1. Let _fobj_ be ! _benvRec_.GetBindingValue(_F_, *false*). - 1. Perform ? _genvRec_.SetMutableBinding(_F_, _fobj_, *false*). + 1. Let _fobj_ be ! _benv_.GetBindingValue(_F_, *false*). + 1. Perform ? _genv_.SetMutableBinding(_F_, _fobj_, *false*). 1. Return NormalCompletion(~empty~).

Changes to EvalDeclarationInstantiation

-

During EvalDeclarationInstantiation the following steps are performed in place of step 9:

+

During EvalDeclarationInstantiation the following steps are performed in place of step 7:

1. If _strict_ is *false*, then 1. Let _declaredFunctionOrVarNames_ be a new empty List. @@ -42978,38 +42955,35 @@

Changes to EvalDeclarationInstantiation

1. Let _F_ be StringValue of the |BindingIdentifier| of _f_. 1. If replacing the |FunctionDeclaration| _f_ with a |VariableStatement| that has _F_ as a |BindingIdentifier| would not produce any Early Errors for _body_, then 1. Let _bindingExists_ be *false*. - 1. Let _thisLex_ be _lexEnv_. + 1. Let _thisEnv_ be _lexEnv_. 1. Assert: The following loop will terminate. - 1. Repeat, while _thisLex_ is not the same as _varEnv_, - 1. Let _thisEnvRec_ be _thisLex_'s EnvironmentRecord. - 1. If _thisEnvRec_ is not an object Environment Record, then - 1. If _thisEnvRec_.HasBinding(_F_) is *true*, then + 1. Repeat, while _thisEnv_ is not the same as _varEnv_, + 1. If _thisEnv_ is not an object Environment Record, then + 1. If _thisEnv_.HasBinding(_F_) is *true*, then 1. Let _bindingExists_ be *true*. - 1. Set _thisLex_ to _thisLex_'s outer environment reference. - 1. If _bindingExists_ is *false* and _varEnvRec_ is a global Environment Record, then - 1. If _varEnvRec_.HasLexicalDeclaration(_F_) is *false*, then - 1. Let _fnDefinable_ be ? _varEnvRec_.CanDeclareGlobalVar(_F_). + 1. Set _thisEnv_ to _thisEnv_.[[OuterEnv]]. + 1. If _bindingExists_ is *false* and _varEnv_ is a global Environment Record, then + 1. If _varEnv_.HasLexicalDeclaration(_F_) is *false*, then + 1. Let _fnDefinable_ be ? _varEnv_.CanDeclareGlobalVar(_F_). 1. Else, 1. Let _fnDefinable_ be *false*. 1. Else, 1. Let _fnDefinable_ be *true*. 1. If _bindingExists_ is *false* and _fnDefinable_ is *true*, then 1. If _declaredFunctionOrVarNames_ does not contain _F_, then - 1. If _varEnvRec_ is a global Environment Record, then - 1. Perform ? _varEnvRec_.CreateGlobalVarBinding(_F_, *true*). + 1. If _varEnv_ is a global Environment Record, then + 1. Perform ? _varEnv_.CreateGlobalVarBinding(_F_, *true*). 1. Else, - 1. Let _bindingExists_ be _varEnvRec_.HasBinding(_F_). + 1. Let _bindingExists_ be _varEnv_.HasBinding(_F_). 1. If _bindingExists_ is *false*, then - 1. Perform ! _varEnvRec_.CreateMutableBinding(_F_, *true*). - 1. Perform ! _varEnvRec_.InitializeBinding(_F_, *undefined*). + 1. Perform ! _varEnv_.CreateMutableBinding(_F_, *true*). + 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 _genvRec_ be _genv_'s EnvironmentRecord. 1. Let _benv_ be the running execution context's LexicalEnvironment. - 1. Let _benvRec_ be _benv_'s EnvironmentRecord. - 1. Let _fobj_ be ! _benvRec_.GetBindingValue(_F_, *false*). - 1. Perform ? _genvRec_.SetMutableBinding(_F_, _fobj_, *false*). + 1. Let _fobj_ be ! _benv_.GetBindingValue(_F_, *false*). + 1. Perform ? _genv_.SetMutableBinding(_F_, _fobj_, *false*). 1. Return NormalCompletion(~empty~).
@@ -43035,18 +43009,18 @@

Changes to `switch` Statement Static Semantics: Early Errors

Changes to BlockDeclarationInstantiation

-

During BlockDeclarationInstantiation the following steps are performed in place of step 4.a.ii.1:

+

During BlockDeclarationInstantiation the following steps are performed in place of step 3.a.ii.1:

- 1. If _envRec_.HasBinding(_dn_) is *false*, then - 1. Perform ! _envRec_.CreateMutableBinding(_dn_, *false*). + 1. If _env_.HasBinding(_dn_) is *false*, then + 1. Perform ! _env_.CreateMutableBinding(_dn_, *false*). -

During BlockDeclarationInstantiation the following steps are performed in place of step 4.b.iii:

+

During BlockDeclarationInstantiation the following steps are performed in place of step 3.b.iii:

- 1. If the binding for _fn_ in _envRec_ is an uninitialized binding, then - 1. Perform _envRec_.InitializeBinding(_fn_, _fo_). + 1. If the binding for _fn_ in _env_ is an uninitialized binding, then + 1. Perform _env_.InitializeBinding(_fn_, _fo_). 1. Else, 1. Assert: _d_ is a |FunctionDeclaration|. - 1. Perform _envRec_.SetMutableBinding(_fn_, _fo_, *false*). + 1. Perform _env_.SetMutableBinding(_fn_, _fo_, *false*).
@@ -43083,13 +43057,13 @@

VariableStatements in Catch Blocks

The |Block| of a |Catch| clause may contain `var` declarations that bind a name that is also bound by the |CatchParameter|. At runtime, such bindings are instantiated in the VariableDeclarationEnvironment. They do not shadow the same-named bindings introduced by the |CatchParameter| and hence the |Initializer| for such `var` declarations will assign to the corresponding catch parameter rather than the `var` binding.

This modified behaviour also applies to `var` and `function` declarations introduced by direct eval calls contained within the |Block| of a |Catch| clause. This change is accomplished by modifying the algorithm of as follows:

-

Step 5.d.ii.2.a.i is replaced by:

+

Step 3.d.i.2.a.i is replaced by:

- 1. If _thisEnvRec_ is not the Environment Record for a |Catch| clause, throw a *SyntaxError* exception. + 1. If _thisEnv_ is not the Environment Record for a |Catch| clause, throw a *SyntaxError* exception. -

Step 9.d.ii.4.b.i.i is replaced by:

+

Step 7.d.ii.4.a.i.i is replaced by:

- 1. If _thisEnvRec_ is not the Environment Record for a |Catch| clause, let _bindingExists_ be *true*. + 1. If _thisEnv_ is not the Environment Record for a |Catch| clause, let _bindingExists_ be *true*.

- Lexical Environment + Environment Record - The Lexical Environment that the function was closed over. Used as the outer environment when evaluating the code of the function. + The Environment Record that the function was closed over. Used as the outer environment when evaluating the code of the function.
- Lexical Environment | *undefined* + Environment Record | *undefined* - The Lexical Environment containing the top level bindings for this script. This field is set when the script is instantiated. + The Environment Record containing the top level bindings for this script. This field is set when the script is instantiated.
- Lexical Environment | *undefined* + module Environment Record | *undefined* - The Lexical Environment containing the top level bindings for this module. This field is set when the module is linked. + The Environment Record containing the top level bindings for this module. This field is set when the module is linked.
- Initialize the Lexical Environment of the module, including resolving all imported bindings, and create the module's execution context. + Initialize the Environment Record of the module, including resolving all imported bindings, and create the module's execution context.