From 24b2f6e4a31600a0f61b41492f288c24b360a285 Mon Sep 17 00:00:00 2001 From: Michael Dyck Date: Sat, 23 Jan 2021 23:59:22 -0500 Subject: [PATCH] Editorial: Declarative Env Rec has field [[Bindings]] ... that is a List of bindings (without being specific yet about what a binding is). --- spec.html | 58 +++++++++++++++++++++++++++++++++++++++++-------------- 1 file changed, 44 insertions(+), 14 deletions(-) diff --git a/spec.html b/spec.html index 6efd6c78d13..089d8ec0fd7 100644 --- a/spec.html +++ b/spec.html @@ -9989,6 +9989,33 @@

The Environment Record Type Hierarchy

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.

+

Declarative Environment Records have the additional fields listed in .

+ + + + + + + + + + + + +
+ Field Name + + Value + + Meaning +
+ [[Bindings]] + + a List of bindings + + Satisfies the invariant that no two bindings in [[Bindings]] are bindings for the same name. +
+

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

@@ -10005,7 +10032,7 @@

It determines if the argument identifier is one of the identifiers bound by the record.
- 1. If _envRec_ has a binding for _N_, return *true*. + 1. If _envRec_.[[Bindings]] contains a binding for _N_, return *true*. 1. Return *false*. @@ -10027,7 +10054,7 @@

1. Assert: _envRec_.HasBinding(_N_) is *false*. 1. Let _binding_ be a mutable binding for _N_ and record that it is uninitialized. If _D_ is *true*, record that the newly created binding may be deleted by a subsequent DeleteBinding call. - 1. Add _binding_ to _envRec_. + 1. Append _binding_ to _envRec_.[[Bindings]]. 1. Return ~unused~. @@ -10049,7 +10076,7 @@

1. Assert: _envRec_.HasBinding(_N_) is *false*. 1. Let _binding_ be an immutable binding for _N_ and record that it is uninitialized. If _S_ is *true*, record that the newly created binding is a strict binding. - 1. Add _binding_ to _envRec_. + 1. Append _binding_ to _envRec_.[[Bindings]]. 1. Return ~unused~. @@ -10070,7 +10097,7 @@

1. Assert: _envRec_.HasBinding(_N_) is *true*. - 1. Let _binding_ be the binding for _N_ in _envRec_. + 1. Let _binding_ be the binding for _N_ in _envRec_.[[Bindings]]. 1. Assert: _binding_ is uninitialized. 1. Set the bound value of _binding_ to _V_. 1. Record that _binding_ has been initialized. @@ -10099,7 +10126,7 @@

1. Perform ! _envRec_.CreateMutableBinding(_N_, *true*). 1. Perform ! _envRec_.InitializeBinding(_N_, _V_). 1. Return ~unused~. - 1. Let _binding_ be the binding for _N_ in _envRec_. + 1. Let _binding_ be the binding for _N_ in _envRec_.[[Bindings]]. 1. If _binding_ is a strict binding, set _S_ to *true*. 1. If _binding_ has not yet been initialized, then 1. Throw a *ReferenceError* exception. @@ -10132,7 +10159,7 @@

1. Assert: _envRec_.HasBinding(_N_) is *true*. - 1. Let _binding_ be the binding for _N_ in _envRec_. + 1. Let _binding_ be the binding for _N_ in _envRec_.[[Bindings]]. 1. If _binding_ is an uninitialized binding, throw a *ReferenceError* exception. 1. Return the value currently bound in _binding_. @@ -10153,9 +10180,9 @@

1. Assert: _envRec_.HasBinding(_N_) is *true*. - 1. Let _binding_ be the binding for _N_ in _envRec_. + 1. Let _binding_ be the binding for _N_ in _envRec_.[[Bindings]]. 1. If _binding_ cannot be deleted, return *false*. - 1. Remove _binding_ from _envRec_. + 1. Remove _binding_ from _envRec_.[[Bindings]]. 1. Return *true*. @@ -11182,7 +11209,7 @@

1. Assert: _S_ is *true*. 1. Assert: _envRec_.HasBinding(_N_) is *true*. - 1. Let _binding_ be the binding for _N_ in _envRec_. + 1. Let _binding_ be the binding for _N_ in _envRec_.[[Bindings]]. 1. If _binding_ is an indirect binding, then 1. Let _M_ and _N2_ be the indirection values provided when this binding for _N_ was created. 1. Let _targetEnv_ be _M_.[[Environment]]. @@ -11248,7 +11275,7 @@

1. Assert: _envRec_.HasBinding(_N_) is *false*. 1. Assert: When _M_.[[Environment]] is instantiated, it will have a direct binding for _N2_. 1. Let _binding_ be an immutable indirect binding for _N_ that references _M_ and _N2_ as its target binding and record that the binding is initialized. - 1. Add _binding_ to _envRec_. + 1. Append _binding_ to _envRec_.[[Bindings]]. 1. Return ~unused~. @@ -11290,7 +11317,8 @@

- 1. Let _env_ be a new Declarative Environment Record containing no bindings. + 1. Let _env_ be a new Declarative Environment Record. + 1. Set _env_.[[Bindings]] to « ». 1. Set _env_.[[OuterEnv]] to _E_. 1. Return _env_. @@ -11325,7 +11353,8 @@

- 1. Let _env_ be a new Function Environment Record containing no bindings. + 1. Let _env_ be a new Function Environment Record. + 1. Set _env_.[[Bindings]] to « ». 1. Set _env_.[[FunctionObject]] to _F_. 1. If _F_.[[ThisMode]] is ~lexical~, set _env_.[[ThisBindingStatus]] to ~lexical~. 1. Else, set _env_.[[ThisBindingStatus]] to ~uninitialized~. @@ -11366,7 +11395,8 @@

- 1. Let _env_ be a new Module Environment Record containing no bindings. + 1. Let _env_ be a new Module Environment Record. + 1. Set _env_.[[Bindings]] to « ». 1. Set _env_.[[OuterEnv]] to _E_. 1. Return _env_. @@ -48609,7 +48639,7 @@

Changes to BlockDeclarationInstantiation

During BlockDeclarationInstantiation the following steps are performed in place of step :

1. Perform the following steps: - 1. Let _binding_ be the binding for _fn_ in _env_. + 1. Let _binding_ be the binding for _fn_ in _env_.[[Bindings]]. 1. If _binding_ is an uninitialized binding, then 1. Perform ! _env_.InitializeBinding(_fn_, _fo_). 1. Else,