Skip to content
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.

Commit 6322daa

Browse files
bfarias-godaddyljharb
authored andcommittedAug 26, 2020
Editorial: stop using strings for special values (tc39#2155)
This was extracted from tc39#2154 so it could land separately.
1 parent 420e82e commit 6322daa

File tree

1 file changed

+25
-25
lines changed

1 file changed

+25
-25
lines changed
 

Diff for: ‎spec.html

+25-25
Original file line numberDiff line numberDiff line change
@@ -10019,7 +10019,7 @@ <h1>[[Get]] ( _P_, _Receiver_ )</h1>
1001910019
1. Assert: _binding_ is a ResolvedBinding Record.
1002010020
1. Let _targetModule_ be _binding_.[[Module]].
1002110021
1. Assert: _targetModule_ is not *undefined*.
10022-
1. If _binding_.[[BindingName]] is *"\*namespace\*"*, then
10022+
1. If _binding_.[[BindingName]] is ~namespace~, then
1002310023
1. Return ? GetModuleNamespace(_targetModule_).
1002410024
1. Let _targetEnv_ be _targetModule_.[[Environment]].
1002510025
1. If _targetEnv_ is *undefined*, throw a *ReferenceError* exception.
@@ -12730,7 +12730,7 @@ <h1>Runtime Semantics: BindingInitialization</h1>
1273012730
<h1>Runtime Semantics: InitializeBoundName ( _name_, _value_, _environment_ )</h1>
1273112731
<p>The abstract operation InitializeBoundName takes arguments _name_, _value_, and _environment_. It performs the following steps when called:</p>
1273212732
<emu-alg>
12733-
1. Assert: Type(_name_) is String.
12733+
1. Assert: Either Type(_name_) is String, or _name_ is ~default~.
1273412734
1. If _environment_ is not *undefined*, then
1273512735
1. Perform _environment_.InitializeBinding(_name_, _value_).
1273612736
1. Return NormalCompletion(*undefined*).
@@ -19955,10 +19955,10 @@ <h1>Static Semantics: BoundNames</h1>
1995519955
</emu-alg>
1995619956
<emu-grammar>FunctionDeclaration : `function` `(` FormalParameters `)` `{` FunctionBody `}`</emu-grammar>
1995719957
<emu-alg>
19958-
1. Return &laquo; *"\*default\*"* &raquo;.
19958+
1. Return &laquo; ~default~ &raquo;.
1995919959
</emu-alg>
1996019960
<emu-note>
19961-
<p>*"\*default\*"* is used within this specification as a synthetic name for hoistable anonymous functions that are defined using export declarations.</p>
19961+
<p>~default~ is used within this specification as a synthetic name for hoistable anonymous functions that are defined using export declarations.</p>
1996219962
</emu-note>
1996319963
<emu-grammar>FormalParameters : [empty]</emu-grammar>
1996419964
<emu-alg>
@@ -20892,10 +20892,10 @@ <h1>Static Semantics: BoundNames</h1>
2089220892
</emu-alg>
2089320893
<emu-grammar>GeneratorDeclaration : `function` `*` `(` FormalParameters `)` `{` GeneratorBody `}`</emu-grammar>
2089420894
<emu-alg>
20895-
1. Return &laquo; *"\*default\*"* &raquo;.
20895+
1. Return &laquo; ~default~ &raquo;.
2089620896
</emu-alg>
2089720897
<emu-note>
20898-
<p>*"\*default\*"* is used within this specification as a synthetic name for hoistable anonymous functions that are defined using export declarations.</p>
20898+
<p>~default~ is used within this specification as a synthetic name for hoistable anonymous functions that are defined using export declarations.</p>
2089920899
</emu-note>
2090020900
</emu-clause>
2090120901

@@ -21215,10 +21215,10 @@ <h1>Static Semantics: BoundNames</h1>
2121521215
</emu-alg>
2121621216
<emu-grammar>AsyncGeneratorDeclaration : `async` `function` `*` `(` FormalParameters `)` `{` AsyncGeneratorBody `}`</emu-grammar>
2121721217
<emu-alg>
21218-
1. Return &laquo; *"\*default\*"* &raquo;.
21218+
1. Return &laquo; ~default~ &raquo;.
2121921219
</emu-alg>
2122021220
<emu-note>
21221-
<p>*"\*default\*"* is used within this specification as a synthetic name for hoistable anonymous functions that are defined using export declarations.</p>
21221+
<p>~default~ is used within this specification as a synthetic name for hoistable anonymous functions that are defined using export declarations.</p>
2122221222
</emu-note>
2122321223
</emu-clause>
2122421224

@@ -21502,7 +21502,7 @@ <h1>Static Semantics: BoundNames</h1>
2150221502
</emu-alg>
2150321503
<emu-grammar>ClassDeclaration : `class` ClassTail</emu-grammar>
2150421504
<emu-alg>
21505-
1. Return &laquo; *"\*default\*"* &raquo;.
21505+
1. Return &laquo; ~default~ &raquo;.
2150621506
</emu-alg>
2150721507
</emu-clause>
2150821508

@@ -21877,9 +21877,9 @@ <h1>Static Semantics: BoundNames</h1>
2187721877
AsyncFunctionDeclaration : `async` `function` `(` FormalParameters `)` `{` AsyncFunctionBody `}`
2187821878
</emu-grammar>
2187921879
<emu-alg>
21880-
1. Return &laquo; *"\*default\*"* &raquo;.
21880+
1. Return &laquo; ~default~ &raquo;.
2188121881
</emu-alg>
21882-
<emu-note>*"\*default\*"* is used within this specification as a synthetic name for hoistable anonymous functions that are defined using export declarations.</emu-note>
21882+
<emu-note>~default~ is used within this specification as a synthetic name for hoistable anonymous functions that are defined using export declarations.</emu-note>
2188321883
</emu-clause>
2188421884

2188521885
<emu-clause id="sec-async-function-definitions-static-semantics-ComputedPropertyContains">
@@ -23443,7 +23443,7 @@ <h1>Abstract Module Records</h1>
2344323443
ResolveExport(_exportName_ [, _resolveSet_])
2344423444
</td>
2344523445
<td>
23446-
<p>Return the binding of a name exported by this module. Bindings are represented by a <dfn id="resolvedbinding-record">ResolvedBinding Record</dfn>, of the form { [[Module]]: Module Record, [[BindingName]]: String }. If the export is a Module Namespace Object without a direct binding in any module, [[BindingName]] will be set to *"\*namespace\*"*. Return *null* if the name cannot be resolved, or *"ambiguous"* if multiple bindings were found.</p>
23446+
<p>Return the binding of a name exported by this module. Bindings are represented by a <dfn id="resolvedbinding-record">ResolvedBinding Record</dfn>, of the form { [[Module]]: Module Record, [[BindingName]]: String }. If the export is a Module Namespace Object without a direct binding in any module, [[BindingName]] will be set to ~namespace~. Return *null* if the name cannot be resolved, or *"ambiguous"* if multiple bindings were found.</p>
2344723447
<p>Each time this operation is called with a specific _exportName_, _resolveSet_ pair as arguments it must return the same result if it completes normally.</p>
2344823448
</td>
2344923449
</tr>
@@ -24126,7 +24126,7 @@ <h1>Source Text Module Records</h1>
2412624126
*null*
2412724127
</td>
2412824128
<td>
24129-
*"\*default\*"*
24129+
~default~
2413024130
</td>
2413124131
</tr>
2413224132
<tr>
@@ -24143,7 +24143,7 @@ <h1>Source Text Module Records</h1>
2414324143
*null*
2414424144
</td>
2414524145
<td>
24146-
*"\*default\*"*
24146+
~default~
2414724147
</td>
2414824148
</tr>
2414924149
<tr>
@@ -24328,7 +24328,7 @@ <h1>GetExportedNames ( [ _exportStarSet_ ] ) Concrete Method</h1>
2432824328
<h1>ResolveExport ( _exportName_ [ , _resolveSet_ ] ) Concrete Method</h1>
2432924329
<p>The ResolveExport concrete method of a Source Text Module Record implements the corresponding Module Record abstract method.</p>
2433024330
<p>ResolveExport attempts to resolve an imported binding to the actual defining module and local binding name. The defining module may be the module represented by the Module Record this method was invoked on or some other module that is imported by that module. The parameter _resolveSet_ is used to detect unresolved circular import/export paths. If a pair consisting of specific Module Record and _exportName_ is reached that is already in _resolveSet_, an import circularity has been encountered. Before recursively calling ResolveExport, a pair consisting of _module_ and _exportName_ is added to _resolveSet_.</p>
24331-
<p>If a defining module is found, a ResolvedBinding Record { [[Module]], [[BindingName]] } is returned. This record identifies the resolved binding of the originally requested export, unless this is the export of a namespace with no local binding. In this case, [[BindingName]] will be set to *"\*namespace\*"*. If no definition was found or the request is found to be circular, *null* is returned. If the request is found to be ambiguous, the string *"ambiguous"* is returned.</p>
24331+
<p>If a defining module is found, a ResolvedBinding Record { [[Module]], [[BindingName]] } is returned. This record identifies the resolved binding of the originally requested export, unless this is the export of a namespace with no local binding. In this case, [[BindingName]] will be set to ~namespace~. If no definition was found or the request is found to be circular, *null* is returned. If the request is found to be ambiguous, the string *"ambiguous"* is returned.</p>
2433224332
<p>This abstract method performs the following steps:</p>
2433324333

2433424334
<emu-alg>
@@ -24349,7 +24349,7 @@ <h1>ResolveExport ( _exportName_ [ , _resolveSet_ ] ) Concrete Method</h1>
2434924349
1. Let _importedModule_ be ? HostResolveImportedModule(_module_, _e_.[[ModuleRequest]]).
2435024350
1. If _e_.[[ImportName]] is *"\*"*, then
2435124351
1. Assert: _module_ does not provide the direct binding for this export.
24352-
1. Return ResolvedBinding Record { [[Module]]: _importedModule_, [[BindingName]]: *"\*namespace\*"* }.
24352+
1. Return ResolvedBinding Record { [[Module]]: _importedModule_, [[BindingName]]: ~namespace~ }.
2435324353
1. Else,
2435424354
1. Assert: _module_ imports a specific binding for this export.
2435524355
1. Return _importedModule_.ResolveExport(_e_.[[ImportName]], _resolveSet_).
@@ -24398,7 +24398,7 @@ <h1>InitializeEnvironment ( ) Concrete Method</h1>
2439824398
1. Else,
2439924399
1. Let _resolution_ be ? _importedModule_.ResolveExport(_in_.[[ImportName]]).
2440024400
1. If _resolution_ is *null* or *"ambiguous"*, throw a *SyntaxError* exception.
24401-
1. If _resolution_.[[BindingName]] is *"\*namespace\*"*, then
24401+
1. If _resolution_.[[BindingName]] is ~namespace~, then
2440224402
1. Let _namespace_ be ? GetModuleNamespace(_resolution_.[[Module]]).
2440324403
1. Perform ! _env_.CreateImmutableBinding(_in_.[[LocalName]], *true*).
2440424404
1. Call _env_.InitializeBinding(_in_.[[LocalName]], _namespace_).
@@ -24835,18 +24835,18 @@ <h1>Static Semantics: BoundNames</h1>
2483524835
<emu-grammar>ExportDeclaration : `export` `default` HoistableDeclaration</emu-grammar>
2483624836
<emu-alg>
2483724837
1. Let _declarationNames_ be the BoundNames of |HoistableDeclaration|.
24838-
1. If _declarationNames_ does not include the element *"\*default\*"*, append *"\*default\*"* to _declarationNames_.
24838+
1. If _declarationNames_ does not include the element ~default~, append ~default~ to _declarationNames_.
2483924839
1. Return _declarationNames_.
2484024840
</emu-alg>
2484124841
<emu-grammar>ExportDeclaration : `export` `default` ClassDeclaration</emu-grammar>
2484224842
<emu-alg>
2484324843
1. Let _declarationNames_ be the BoundNames of |ClassDeclaration|.
24844-
1. If _declarationNames_ does not include the element *"\*default\*"*, append *"\*default\*"* to _declarationNames_.
24844+
1. If _declarationNames_ does not include the element ~default~, append ~default~ to _declarationNames_.
2484524845
1. Return _declarationNames_.
2484624846
</emu-alg>
2484724847
<emu-grammar>ExportDeclaration : `export` `default` AssignmentExpression `;`</emu-grammar>
2484824848
<emu-alg>
24849-
1. Return &laquo; *"\*default\*"* &raquo;.
24849+
1. Return &laquo; ~default~ &raquo;.
2485024850
</emu-alg>
2485124851
</emu-clause>
2485224852

@@ -25001,11 +25001,11 @@ <h1>Static Semantics: ExportEntries</h1>
2500125001
</emu-alg>
2500225002
<emu-grammar>ExportDeclaration : `export` `default` AssignmentExpression `;`</emu-grammar>
2500325003
<emu-alg>
25004-
1. Let _entry_ be the ExportEntry Record { [[ModuleRequest]]: *null*, [[ImportName]]: *null*, [[LocalName]]: *"\*default\*"*, [[ExportName]]: *"default"* }.
25004+
1. Let _entry_ be the ExportEntry Record { [[ModuleRequest]]: *null*, [[ImportName]]: *null*, [[LocalName]]: ~default~, [[ExportName]]: *"default"* }.
2500525005
1. Return a new List containing _entry_.
2500625006
</emu-alg>
2500725007
<emu-note>
25008-
<p>*"\*default\*"* is used within this specification as a synthetic name for anonymous default export values.</p>
25008+
<p>~default~ is used within this specification as a synthetic name for anonymous default export values.</p>
2500925009
</emu-note>
2501025010
</emu-clause>
2501125011

@@ -25176,9 +25176,9 @@ <h1>Runtime Semantics: Evaluation</h1>
2517625176
<emu-alg>
2517725177
1. Let _value_ be ? BindingClassDeclarationEvaluation of |ClassDeclaration|.
2517825178
1. Let _className_ be the sole element of BoundNames of |ClassDeclaration|.
25179-
1. If _className_ is *"\*default\*"*, then
25179+
1. If _className_ is ~default~, then
2518025180
1. Let _env_ be the running execution context's LexicalEnvironment.
25181-
1. Perform ? InitializeBoundName(*"\*default\*"*, _value_, _env_).
25181+
1. Perform ? InitializeBoundName(~default~, _value_, _env_).
2518225182
1. Return NormalCompletion(~empty~).
2518325183
</emu-alg>
2518425184
<emu-grammar>ExportDeclaration : `export` `default` AssignmentExpression `;`</emu-grammar>
@@ -25189,7 +25189,7 @@ <h1>Runtime Semantics: Evaluation</h1>
2518925189
1. Let _rhs_ be the result of evaluating |AssignmentExpression|.
2519025190
1. Let _value_ be ? GetValue(_rhs_).
2519125191
1. Let _env_ be the running execution context's LexicalEnvironment.
25192-
1. Perform ? InitializeBoundName(*"\*default\*"*, _value_, _env_).
25192+
1. Perform ? InitializeBoundName(~default~, _value_, _env_).
2519325193
1. Return NormalCompletion(~empty~).
2519425194
</emu-alg>
2519525195
</emu-clause>

0 commit comments

Comments
 (0)
Please sign in to comment.