Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Normative: Remove [[VarNames]] from the global #3226

Open
wants to merge 2 commits into
base: main
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
55 changes: 4 additions & 51 deletions spec.html
Original file line number Diff line number Diff line change
Expand Up @@ -10652,17 +10652,6 @@ <h1>Global Environment Records</h1>
<emu-not-ref>Contains</emu-not-ref> bindings for all declarations in global code for the associated realm code except for |FunctionDeclaration|, |GeneratorDeclaration|, |AsyncFunctionDeclaration|, |AsyncGeneratorDeclaration|, and |VariableDeclaration| bindings.
</td>
</tr>
<tr>
<td>
[[VarNames]]
</td>
<td>
a List of Strings
</td>
<td>
The string names bound by |FunctionDeclaration|, |GeneratorDeclaration|, |AsyncFunctionDeclaration|, |AsyncGeneratorDeclaration|, and |VariableDeclaration| declarations in global code for the associated realm.
</td>
</tr>
</table>
</emu-table>
<emu-table id="table-additional-methods-of-global-environment-records" caption="Additional Methods of Global Environment Records" oldids="table-19">
Expand All @@ -10683,14 +10672,6 @@ <h1>Global Environment Records</h1>
Return the value of this Environment Record's `this` binding.
</td>
</tr>
<tr>
<td>
HasVarDeclaration (N)
</td>
<td>
Determines if the argument identifier has a binding in this Environment Record that was created using a |VariableDeclaration|, |FunctionDeclaration|, |GeneratorDeclaration|, |AsyncFunctionDeclaration|, or |AsyncGeneratorDeclaration|.
</td>
</tr>
<tr>
<td>
HasLexicalDeclaration (N)
Expand Down Expand Up @@ -10898,10 +10879,7 @@ <h1>
1. Let _globalObject_ be _ObjRec_.[[BindingObject]].
1. Let _existingProp_ be ? HasOwnProperty(_globalObject_, _N_).
1. If _existingProp_ is *true*, then
1. Let _status_ be ? <emu-meta effects="user-code">_ObjRec_.DeleteBinding</emu-meta>(_N_).
1. If _status_ is *true* and _envRec_.[[VarNames]] contains _N_, then
1. Remove _N_ from _envRec_.[[VarNames]].
1. Return _status_.
1. Return ? <emu-meta effects="user-code">_ObjRec_.DeleteBinding</emu-meta>(_N_).
1. Return *true*.
</emu-alg>
</emu-clause>
Expand Down Expand Up @@ -10956,26 +10934,6 @@ <h1>GetThisBinding ( ): a normal completion containing an Object</h1>
</emu-alg>
</emu-clause>

<emu-clause id="sec-hasvardeclaration" type="concrete method">
<h1>
HasVarDeclaration (
_N_: a String,
): a Boolean
</h1>
<dl class="header">
<dt>for</dt>
<dd>a Global Environment Record _envRec_</dd>

<dt>description</dt>
<dd>It determines if the argument identifier has a binding in this record that was created using a |VariableStatement| or a |FunctionDeclaration|.</dd>
</dl>
<emu-alg>
1. Let _varDeclaredNames_ be _envRec_.[[VarNames]].
1. If _varDeclaredNames_ contains _N_, return *true*.
1. Return *false*.
</emu-alg>
</emu-clause>

<emu-clause id="sec-haslexicaldeclaration" type="concrete method">
<h1>
HasLexicalDeclaration (
Expand Down Expand Up @@ -11079,7 +11037,7 @@ <h1>
<dd>a Global Environment Record _envRec_</dd>

<dt>description</dt>
<dd>It creates and initializes a mutable binding in the associated Object Environment Record and records the bound name in the associated [[VarNames]] List. If a binding already exists, it is reused and assumed to be initialized.</dd>
<dd>It creates and initializes a mutable binding in the associated Object Environment Record. If a binding already exists, it is reused and assumed to be initialized.</dd>
</dl>
<emu-alg>
1. Let _ObjRec_ be _envRec_.[[ObjectRecord]].
Expand All @@ -11089,8 +11047,6 @@ <h1>
1. If _hasProperty_ is *false* and _extensible_ is *true*, then
1. Perform ? <emu-meta effects="user-code">_ObjRec_.CreateMutableBinding</emu-meta>(_N_, _D_).
1. Perform ? <emu-meta effects="user-code">_ObjRec_.InitializeBinding</emu-meta>(_N_, *undefined*).
1. If _envRec_.[[VarNames]] does not contain _N_, then
1. Append _N_ to _envRec_.[[VarNames]].
1. Return ~unused~.
</emu-alg>
</emu-clause>
Expand All @@ -11108,7 +11064,7 @@ <h1>
<dd>a Global Environment Record _envRec_</dd>

<dt>description</dt>
<dd>It creates and initializes a mutable binding in the associated Object Environment Record and records the bound name in the associated [[VarNames]] List. If a binding already exists, it is replaced.</dd>
<dd>It creates and initializes a mutable binding in the associated Object Environment Record. If a binding already exists, it is replaced.</dd>
</dl>
<emu-alg>
1. Let _ObjRec_ be _envRec_.[[ObjectRecord]].
Expand All @@ -11120,8 +11076,6 @@ <h1>
1. Let _desc_ be the PropertyDescriptor { [[Value]]: _V_ }.
1. Perform ? DefinePropertyOrThrow(_globalObject_, _N_, _desc_).
1. [id="step-createglobalfunctionbinding-set"] Perform ? Set(_globalObject_, _N_, _V_, *false*).
1. If _envRec_.[[VarNames]] does not contain _N_, then
1. Append _N_ to _envRec_.[[VarNames]].
1. Return ~unused~.
</emu-alg>
<emu-note>
Expand Down Expand Up @@ -11348,7 +11302,6 @@ <h1>
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_.
</emu-alg>
Expand Down Expand Up @@ -25952,9 +25905,9 @@ <h1>
1. Let _lexNames_ be the LexicallyDeclaredNames of _script_.
1. Let _varNames_ be the VarDeclaredNames of _script_.
1. For each element _name_ of _lexNames_, do
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. NOTE: Global `var` and `function` bindings (except those that are introduced by non-strict direct eval) are non-configurable and are therefore restricted global properties.
1. If _hasRestrictedGlobal_ is *true*, throw a *SyntaxError* exception.
1. For each element _name_ of _varNames_, do
1. If _env_.HasLexicalDeclaration(_name_) is *true*, throw a *SyntaxError* exception.
Expand Down
Loading