Skip to content

Commit

Permalink
for each _x_ of -> for each element _x_ of
Browse files Browse the repository at this point in the history
  • Loading branch information
bakkot committed Aug 23, 2020
1 parent 93b8db0 commit 764271e
Showing 1 changed file with 33 additions and 33 deletions.
66 changes: 33 additions & 33 deletions spec.html
Original file line number Diff line number Diff line change
Expand Up @@ -4677,7 +4677,7 @@ <h1>OrdinaryToPrimitive ( _O_, _hint_ )</h1>
1. Let _methodNames_ be &laquo; *"toString"*, *"valueOf"* &raquo;.
1. Else,
1. Let _methodNames_ be &laquo; *"valueOf"*, *"toString"* &raquo;.
1. For each _name_ of _methodNames_, do
1. For each element _name_ of _methodNames_, do
1. Let _method_ be ? Get(_O_, _name_).
1. If IsCallable(_method_) is *true*, then
1. Let _result_ be ? Call(_method_, _O_).
Expand Down Expand Up @@ -8156,7 +8156,7 @@ <h1>Execution</h1>
<p>At any time, if a set of objects _S_ is not live, an ECMAScript implementation may perform the following steps atomically:</p>

<emu-alg>
1. For each _obj_ of _S_, do
1. For each element _obj_ of _S_, do
1. For each WeakRef _ref_ such that _ref_.[[WeakRefTarget]] is _obj_, do
1. Set _ref_.[[WeakRefTarget]] to ~empty~.
1. For each FinalizationRegistry _fg_ such that _fg_.[[Cells]] contains a Record _cell_ such that _cell_.[[WeakRefTarget]] is _obj_, do
Expand Down Expand Up @@ -9012,7 +9012,7 @@ <h1>FunctionDeclarationInstantiation ( _func_, _argumentsList_ )</h1>
1. Let _lexicalNames_ be the LexicallyDeclaredNames of _code_.
1. Let _functionNames_ be a new empty List.
1. Let _functionsToInitialize_ be a new empty List.
1. For each _d_ of _varDeclarations_, in reverse List order, do
1. For each element _d_ of _varDeclarations_, in reverse List order, do
1. If _d_ is neither a |VariableDeclaration| nor a |ForBinding| nor a |BindingIdentifier|, then
1. Assert: _d_ is either a |FunctionDeclaration|, a |GeneratorDeclaration|, an |AsyncFunctionDeclaration|, or an |AsyncGeneratorDeclaration|.
1. Let _fn_ be the sole element of the BoundNames of _d_.
Expand Down Expand Up @@ -9067,7 +9067,7 @@ <h1>FunctionDeclarationInstantiation ( _func_, _argumentsList_ )</h1>
1. If _hasParameterExpressions_ is *false*, then
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_ of _varNames_, do
1. For each element _n_ of _varNames_, do
1. If _n_ is not an element of _instantiatedVarNames_, then
1. Append _n_ to _instantiatedVarNames_.
1. Perform ! _env_.CreateMutableBinding(_n_, *false*).
Expand All @@ -9078,7 +9078,7 @@ <h1>FunctionDeclarationInstantiation ( _func_, _argumentsList_ )</h1>
1. Let _varEnv_ be NewDeclarativeEnvironment(_env_).
1. Set the VariableEnvironment of _calleeContext_ to _varEnv_.
1. Let _instantiatedVarNames_ be a new empty List.
1. For each _n_ of _varNames_, do
1. For each element _n_ of _varNames_, do
1. If _n_ is not an element of _instantiatedVarNames_, then
1. Append _n_ to _instantiatedVarNames_.
1. Perform ! _varEnv_.CreateMutableBinding(_n_, *false*).
Expand Down Expand Up @@ -10653,11 +10653,11 @@ <h1>[[OwnPropertyKeys]] ( )</h1>
1. If _extensibleTarget_ is *true* and _targetNonconfigurableKeys_ is empty, then
1. Return _trapResult_.
1. Let _uncheckedResultKeys_ be a new List which is a copy of _trapResult_.
1. For each _key_ of _targetNonconfigurableKeys_, do
1. For each element _key_ of _targetNonconfigurableKeys_, do
1. If _key_ is not an element of _uncheckedResultKeys_, throw a *TypeError* exception.
1. Remove _key_ from _uncheckedResultKeys_.
1. If _extensibleTarget_ is *true*, return _trapResult_.
1. For each _key_ of _targetConfigurableKeys_, do
1. For each element _key_ of _targetConfigurableKeys_, do
1. If _key_ is not an element of _uncheckedResultKeys_, throw a *TypeError* exception.
1. Remove _key_ from _uncheckedResultKeys_.
1. If _uncheckedResultKeys_ is not empty, throw a *TypeError* exception.
Expand Down Expand Up @@ -18404,7 +18404,7 @@ <h1>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. For each string _name_ of _uninitializedBoundNames_, do
1. For each String _name_ of _uninitializedBoundNames_, do
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_.
Expand Down Expand Up @@ -18589,7 +18589,7 @@ <h1>%ForInIteratorPrototype%.next ( )</h1>
1. Repeat,
1. If _O_.[[ObjectWasVisited]] is *false*, then
1. Let _keys_ be ? _object_.[[OwnPropertyKeys]]().
1. For each _key_ of _keys_, do
1. For each element _key_ of _keys_, do
1. If Type(_key_) is String, then
1. Append _key_ to _remaining_.
1. Set _O_.[[ObjectWasVisited]] to *true*.
Expand Down Expand Up @@ -22952,17 +22952,17 @@ <h1>Runtime Semantics: GlobalDeclarationInstantiation ( _script_, _env_ )</h1>
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_ of _lexNames_, do
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. If _hasRestrictedGlobal_ is *true*, throw a *SyntaxError* exception.
1. For each _name_ of _varNames_, do
1. For each element _name_ of _varNames_, do
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.
1. For each _d_ of _varDeclarations_, in reverse List order, do
1. For each element _d_ of _varDeclarations_, in reverse List order, do
1. If _d_ is neither a |VariableDeclaration| nor a |ForBinding| nor a |BindingIdentifier|, then
1. Assert: _d_ is either a |FunctionDeclaration|, a |GeneratorDeclaration|, an |AsyncFunctionDeclaration|, or an |AsyncGeneratorDeclaration|.
1. NOTE: If there are multiple function declarations for the same name, the last declaration is used.
Expand All @@ -22973,7 +22973,7 @@ <h1>Runtime Semantics: GlobalDeclarationInstantiation ( _script_, _env_ )</h1>
1. Append _fn_ to _declaredFunctionNames_.
1. Insert _d_ as the first element of _functionsToInitialize_.
1. Let _declaredVarNames_ be a new empty List.
1. For each _d_ of _varDeclarations_, do
1. For each element _d_ of _varDeclarations_, do
1. If _d_ is a |VariableDeclaration|, a |ForBinding|, or a |BindingIdentifier|, then
1. For each String _vn_ of the BoundNames of _d_, do
1. If _vn_ is not an element of _declaredFunctionNames_, then
Expand Down Expand Up @@ -24555,7 +24555,7 @@ <h1>Runtime Semantics: GetModuleNamespace ( _module_ )</h1>
1. If _namespace_ is *undefined*, then
1. Let _exportedNames_ be ? _module_.GetExportedNames().
1. Let _unambiguousNames_ be a new empty List.
1. For each _name_ of _exportedNames_, do
1. For each element _name_ of _exportedNames_, do
1. Let _resolution_ be ? _module_.ResolveExport(_name_).
1. If _resolution_ is a ResolvedBinding Record, append _name_ to _unambiguousNames_.
1. Set _namespace_ to ModuleNamespaceCreate(_module_, _unambiguousNames_).
Expand Down Expand Up @@ -24976,15 +24976,15 @@ <h1>Static Semantics: ExportEntries</h1>
<emu-alg>
1. Let _entries_ be a new empty List.
1. Let _names_ be the BoundNames of |VariableStatement|.
1. For each _name_ of _names_, do
1. For each element _name_ of _names_, do
1. Append the ExportEntry Record { [[ModuleRequest]]: *null*, [[ImportName]]: *null*, [[LocalName]]: _name_, [[ExportName]]: _name_ } to _entries_.
1. Return _entries_.
</emu-alg>
<emu-grammar>ExportDeclaration : `export` Declaration</emu-grammar>
<emu-alg>
1. Let _entries_ be a new empty List.
1. Let _names_ be the BoundNames of |Declaration|.
1. For each _name_ of _names_, do
1. For each element _name_ of _names_, do
1. Append the ExportEntry Record { [[ModuleRequest]]: *null*, [[ImportName]]: *null*, [[LocalName]]: _name_, [[ExportName]]: _name_ } to _entries_.
1. Return _entries_.
</emu-alg>
Expand Down Expand Up @@ -25408,23 +25408,23 @@ <h1>Runtime Semantics: EvalDeclarationInstantiation ( _body_, _varEnv_, _lexEnv_
1. Let _varDeclarations_ be the VarScopedDeclarations of _body_.
1. If _strict_ is *false*, then
1. If _varEnv_ is a global Environment Record, then
1. For each _name_ of _varNames_, do
1. For each element _name_ of _varNames_, do
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 _thisEnv_ be _lexEnv_.
1. Assert: The following loop will terminate.
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_ of _varNames_, do
1. For each element _name_ of _varNames_, do
1. If _thisEnv_.HasBinding(_name_) is *true*, then
1. [id="step-evaldeclarationinstantiation-throw-duplicate-binding"] Throw a *SyntaxError* exception.
1. NOTE: Annex <emu-xref href="#sec-variablestatements-in-catch-blocks"></emu-xref> 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 _thisEnv_ to _thisEnv_.[[OuterEnv]].
1. Let _functionsToInitialize_ be a new empty List.
1. Let _declaredFunctionNames_ be a new empty List.
1. For each _d_ of _varDeclarations_, in reverse List order, do
1. For each element _d_ of _varDeclarations_, in reverse List order, do
1. If _d_ is neither a |VariableDeclaration| nor a |ForBinding| nor a |BindingIdentifier|, then
1. Assert: _d_ is either a |FunctionDeclaration|, a |GeneratorDeclaration|, an |AsyncFunctionDeclaration|, or an |AsyncGeneratorDeclaration|.
1. NOTE: If there are multiple function declarations for the same name, the last declaration is used.
Expand All @@ -25437,7 +25437,7 @@ <h1>Runtime Semantics: EvalDeclarationInstantiation ( _body_, _varEnv_, _lexEnv_
1. Insert _d_ as the first element of _functionsToInitialize_.
1. [id="step-evaldeclarationinstantiation-web-compat-insertion-point"] NOTE: Annex <emu-xref href="#sec-web-compat-evaldeclarationinstantiation"></emu-xref> adds additional steps at this point.
1. Let _declaredVarNames_ be a new empty List.
1. For each _d_ of _varDeclarations_, do
1. For each element _d_ of _varDeclarations_, do
1. If _d_ is a |VariableDeclaration|, a |ForBinding|, or a |BindingIdentifier|, then
1. For each String _vn_ of the BoundNames of _d_, do
1. If _vn_ is not an element of _declaredFunctionNames_, then
Expand Down Expand Up @@ -26233,7 +26233,7 @@ <h1>Runtime Semantics: ObjectDefineProperties ( _O_, _Properties_ )</h1>
1. Let _descObj_ be ? Get(_props_, _nextKey_).
1. Let _desc_ be ? ToPropertyDescriptor(_descObj_).
1. Append the pair (a two element List) consisting of _nextKey_ and _desc_ to the end of _descriptors_.
1. For each _pair_ of _descriptors_, do
1. For each element _pair_ of _descriptors_, do
1. Let _P_ be the first element of _pair_.
1. Let _desc_ be the second element of _pair_.
1. Perform ? DefinePropertyOrThrow(_O_, _P_, _desc_).
Expand Down Expand Up @@ -30950,7 +30950,7 @@ <h1>String.prototype.replaceAll ( _searchValue_, _replaceValue_ )</h1>
1. Set _position_ to ! StringIndexOf(_string_, _searchString_, _position_ + _advanceBy_).
1. Let _endOfLastMatch_ be 0.
1. Let _result_ be the empty String.
1. For each _position_ of _matchPositions_, do
1. For each element _position_ of _matchPositions_, do
1. Let _preserved_ be the substring of _string_ from _endOfLastMatch_ to _position_.
1. If _functionalReplace_ is *true*, then
1. Let _replacement_ be ? ToString(? Call(_replaceValue_, *undefined*, « _searchString_, _position_, _string_ »)).
Expand Down Expand Up @@ -33468,7 +33468,7 @@ <h1>RegExp.prototype [ @@replace ] ( _string_, _replaceValue_ )</h1>
1. Perform ? Set(_rx_, *"lastIndex"*, _nextIndex_, *true*).
1. Let _accumulatedResult_ be the empty String.
1. Let _nextSourcePosition_ be 0.
1. For each _result_ of _results_, do
1. For each element _result_ of _results_, do
1. Let _nCaptures_ be ? LengthOfArrayLike(_result_).
1. Set _nCaptures_ to max(_nCaptures_ - 1, 0).
1. Let _matched_ be ? ToString(? Get(_result_, *"0"*)).
Expand Down Expand Up @@ -36836,7 +36836,7 @@ <h1>Set.prototype.add ( _value_ )</h1>
1. Let _S_ be the *this* value.
1. Perform ? RequireInternalSlot(_S_, [[SetData]]).
1. Let _entries_ be the List that is _S_.[[SetData]].
1. For each _e_ of _entries_, do
1. For each element _e_ of _entries_, do
1. If _e_ is not ~empty~ and SameValueZero(_e_, _value_) is *true*, then
1. Return _S_.
1. If _value_ is *-0*, set _value_ to *+0*.
Expand All @@ -36852,7 +36852,7 @@ <h1>Set.prototype.clear ( )</h1>
1. Let _S_ be the *this* value.
1. Perform ? RequireInternalSlot(_S_, [[SetData]]).
1. Let _entries_ be the List that is _S_.[[SetData]].
1. For each _e_ of _entries_, do
1. For each element _e_ of _entries_, do
1. Replace the element of _entries_ whose value is _e_ with an element whose value is ~empty~.
1. Return *undefined*.
</emu-alg>
Expand All @@ -36873,7 +36873,7 @@ <h1>Set.prototype.delete ( _value_ )</h1>
1. Let _S_ be the *this* value.
1. Perform ? RequireInternalSlot(_S_, [[SetData]]).
1. Let _entries_ be the List that is _S_.[[SetData]].
1. For each _e_ of _entries_, do
1. For each element _e_ of _entries_, do
1. If _e_ is not ~empty~ and SameValueZero(_e_, _value_) is *true*, then
1. Replace the element of _entries_ whose value is _e_ with an element whose value is ~empty~.
1. Return *true*.
Expand Down Expand Up @@ -36904,7 +36904,7 @@ <h1>Set.prototype.forEach ( _callbackfn_ [ , _thisArg_ ] )</h1>
1. Perform ? RequireInternalSlot(_S_, [[SetData]]).
1. If IsCallable(_callbackfn_) is *false*, throw a *TypeError* exception.
1. Let _entries_ be the List that is _S_.[[SetData]].
1. For each _e_ of _entries_, in original insertion order, do
1. For each element _e_ of _entries_, in original insertion order, do
1. If _e_ is not ~empty~, then
1. Perform ? Call(_callbackfn_, _thisArg_, &laquo; _e_, _e_, _S_ &raquo;).
1. Return *undefined*.
Expand All @@ -36926,7 +36926,7 @@ <h1>Set.prototype.has ( _value_ )</h1>
1. Let _S_ be the *this* value.
1. Perform ? RequireInternalSlot(_S_, [[SetData]]).
1. Let _entries_ be the List that is _S_.[[SetData]].
1. For each _e_ of _entries_, do
1. For each element _e_ of _entries_, do
1. If _e_ is not ~empty~ and SameValueZero(_e_, _value_) is *true*, return *true*.
1. Return *false*.
</emu-alg>
Expand All @@ -36948,7 +36948,7 @@ <h1>get Set.prototype.size</h1>
1. Perform ? RequireInternalSlot(_S_, [[SetData]]).
1. Let _entries_ be the List that is _S_.[[SetData]].
1. Let _count_ be 0.
1. For each _e_ of _entries_, do
1. For each element _e_ of _entries_, do
1. If _e_ is not ~empty~, set _count_ to _count_ + 1.
1. Return _count_.
</emu-alg>
Expand Down Expand Up @@ -37309,7 +37309,7 @@ <h1>WeakSet.prototype.add ( _value_ )</h1>
1. Perform ? RequireInternalSlot(_S_, [[WeakSetData]]).
1. If Type(_value_) is not Object, throw a *TypeError* exception.
1. Let _entries_ be the List that is _S_.[[WeakSetData]].
1. For each _e_ of _entries_, do
1. For each element _e_ of _entries_, do
1. If _e_ is not ~empty~ and SameValue(_e_, _value_) is *true*, then
1. Return _S_.
1. Append _value_ as the last element of _entries_.
Expand All @@ -37330,7 +37330,7 @@ <h1>WeakSet.prototype.delete ( _value_ )</h1>
1. Perform ? RequireInternalSlot(_S_, [[WeakSetData]]).
1. If Type(_value_) is not Object, return *false*.
1. Let _entries_ be the List that is _S_.[[WeakSetData]].
1. For each _e_ of _entries_, do
1. For each element _e_ of _entries_, do
1. If _e_ is not ~empty~ and SameValue(_e_, _value_) is *true*, then
1. Replace the element of _entries_ whose value is _e_ with an element whose value is ~empty~.
1. Return *true*.
Expand All @@ -37349,7 +37349,7 @@ <h1>WeakSet.prototype.has ( _value_ )</h1>
1. Perform ? RequireInternalSlot(_S_, [[WeakSetData]]).
1. Let _entries_ be the List that is _S_.[[WeakSetData]].
1. If Type(_value_) is not Object, return *false*.
1. For each _e_ of _entries_, do
1. For each element _e_ of _entries_, do
1. If _e_ is not ~empty~ and SameValue(_e_, _value_) is *true*, return *true*.
1. Return *false*.
</emu-alg>
Expand Down Expand Up @@ -40831,7 +40831,7 @@ <h1>RejectPromise ( _promise_, _reason_ )</h1>
<h1>TriggerPromiseReactions ( _reactions_, _argument_ )</h1>
<p>The abstract operation TriggerPromiseReactions takes arguments _reactions_ (a collection of PromiseReaction Records) and _argument_. It enqueues a new Job for each record in _reactions_. Each such Job processes the [[Type]] and [[Handler]] of the PromiseReaction Record, and if the [[Handler]] is not ~empty~, calls it passing the given argument. If the [[Handler]] is ~empty~, the behaviour is determined by the [[Type]]. It performs the following steps when called:</p>
<emu-alg>
1. For each _reaction_ of _reactions_, in original insertion order, do
1. For each element _reaction_ of _reactions_, in original insertion order, do
1. Let _job_ be NewPromiseReactionJob(_reaction_, _argument_).
1. Perform HostEnqueuePromiseJob(_job_.[[Job]], _job_.[[Realm]]).
1. Return *undefined*.
Expand Down

0 comments on commit 764271e

Please sign in to comment.