Skip to content

Commit

Permalink
Editorial: Declarative Env Rec has field [[Bindings]]
Browse files Browse the repository at this point in the history
... that is a List of bindings
(without being specific yet about what a binding is).
  • Loading branch information
jmdyck committed Apr 20, 2023
1 parent 5f795bb commit 24b2f6e
Showing 1 changed file with 44 additions and 14 deletions.
58 changes: 44 additions & 14 deletions spec.html
Original file line number Diff line number Diff line change
Expand Up @@ -9989,6 +9989,33 @@ <h1>The Environment Record Type Hierarchy</h1>
<emu-clause id="sec-declarative-environment-records">
<h1>Declarative Environment Records</h1>
<p>Each <dfn variants="Declarative Environment Records">Declarative Environment Record</dfn> 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.</p>
<p>Declarative Environment Records have the additional fields listed in <emu-xref href="#table-additional-fields-of-declarative-environment-records"></emu-xref>.</p>
<emu-table id="table-additional-fields-of-declarative-environment-records" caption="Additional Fields of Declarative Environment Records">
<table>
<tr>
<th>
Field Name
</th>
<th>
Value
</th>
<th>
Meaning
</th>
</tr>
<tr>
<td>
[[Bindings]]
</td>
<td>
a List of bindings
</td>
<td>
Satisfies the invariant that no two bindings in [[Bindings]] are bindings for the same name.
</td>
</tr>
</table>
</emu-table>
<p>The behaviour of the concrete specification methods for Declarative Environment Records is defined by the following algorithms.</p>

<emu-clause id="sec-declarative-environment-records-hasbinding-n" type="concrete method">
Expand All @@ -10005,7 +10032,7 @@ <h1>
<dd>It determines if the argument identifier is one of the identifiers bound by the record.</dd>
</dl>
<emu-alg>
1. If _envRec_ has a binding for _N_, return *true*.
1. If _envRec_.[[Bindings]] contains a binding for _N_, return *true*.
1. Return *false*.
</emu-alg>
</emu-clause>
Expand All @@ -10027,7 +10054,7 @@ <h1>
<emu-alg>
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~.
</emu-alg>
</emu-clause>
Expand All @@ -10049,7 +10076,7 @@ <h1>
<emu-alg>
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~.
</emu-alg>
</emu-clause>
Expand All @@ -10070,7 +10097,7 @@ <h1>
</dl>
<emu-alg>
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. <emu-not-ref>Record</emu-not-ref> that _binding_ has been initialized.
Expand Down Expand Up @@ -10099,7 +10126,7 @@ <h1>
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.
Expand Down Expand Up @@ -10132,7 +10159,7 @@ <h1>
</dl>
<emu-alg>
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_.
</emu-alg>
Expand All @@ -10153,9 +10180,9 @@ <h1>
</dl>
<emu-alg>
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*.
</emu-alg>
</emu-clause>
Expand Down Expand Up @@ -11182,7 +11209,7 @@ <h1>
<emu-alg>
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]].
Expand Down Expand Up @@ -11248,7 +11275,7 @@ <h1>
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~.
</emu-alg>
</emu-clause>
Expand Down Expand Up @@ -11290,7 +11317,8 @@ <h1>
<dl class="header">
</dl>
<emu-alg>
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_.
</emu-alg>
Expand Down Expand Up @@ -11325,7 +11353,8 @@ <h1>
<dl class="header">
</dl>
<emu-alg>
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~.
Expand Down Expand Up @@ -11366,7 +11395,8 @@ <h1>
<dl class="header">
</dl>
<emu-alg>
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_.
</emu-alg>
Expand Down Expand Up @@ -48609,7 +48639,7 @@ <h1>Changes to BlockDeclarationInstantiation</h1>
<p>During BlockDeclarationInstantiation the following steps are performed in place of step <emu-xref href="#step-blockdeclarationinstantiation-initializebinding"></emu-xref>:</p>
<emu-alg replaces-step="step-blockdeclarationinstantiation-initializebinding">
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,
Expand Down

0 comments on commit 24b2f6e

Please sign in to comment.