Skip to content

Commit

Permalink
Editorial: Correct usage of 'Let'/'Set' in various algorithms (#2365)
Browse files Browse the repository at this point in the history
  • Loading branch information
h2oche authored and ljharb committed Apr 1, 2021
1 parent 02dcd23 commit a12b4d4
Showing 1 changed file with 15 additions and 27 deletions.
42 changes: 15 additions & 27 deletions spec.html
Original file line number Diff line number Diff line change
Expand Up @@ -6911,10 +6911,8 @@ <h1>Static Semantics: ContainsDuplicateLabels</h1>
<emu-grammar>CaseBlock : `{` CaseClauses? DefaultClause CaseClauses? `}`</emu-grammar>
<emu-alg>
1. If the first |CaseClauses| is present, then
1. Let _hasDuplicates_ be ContainsDuplicateLabels of the first |CaseClauses| with argument _labelSet_.
1. If _hasDuplicates_ is *true*, return *true*.
1. Let _hasDuplicates_ be ContainsDuplicateLabels of |DefaultClause| with argument _labelSet_.
1. If _hasDuplicates_ is *true*, return *true*.
1. If ContainsDuplicateLabels of the first |CaseClauses| with argument _labelSet_ is *true*, return *true*.
1. If ContainsDuplicateLabels of |DefaultClause| with argument _labelSet_ is *true*, return *true*.
1. If the second |CaseClauses| is not present, return *false*.
1. Return ContainsDuplicateLabels of the second |CaseClauses| with argument _labelSet_.
</emu-alg>
Expand Down Expand Up @@ -6959,10 +6957,8 @@ <h1>Static Semantics: ContainsDuplicateLabels</h1>
</emu-alg>
<emu-grammar>TryStatement : `try` Block Catch Finally</emu-grammar>
<emu-alg>
1. Let _hasDuplicates_ be ContainsDuplicateLabels of |Block| with argument _labelSet_.
1. If _hasDuplicates_ is *true*, return *true*.
1. Let _hasDuplicates_ be ContainsDuplicateLabels of |Catch| with argument _labelSet_.
1. If _hasDuplicates_ is *true*, return *true*.
1. If ContainsDuplicateLabels of |Block| with argument _labelSet_ is *true*, return *true*.
1. If ContainsDuplicateLabels of |Catch| with argument _labelSet_ is *true*, return *true*.
1. Return ContainsDuplicateLabels of |Finally| with argument _labelSet_.
</emu-alg>
<emu-grammar>Catch : `catch` `(` CatchParameter `)` Block</emu-grammar>
Expand Down Expand Up @@ -7084,10 +7080,8 @@ <h1>Static Semantics: ContainsUndefinedBreakTarget</h1>
<emu-grammar>CaseBlock : `{` CaseClauses? DefaultClause CaseClauses? `}`</emu-grammar>
<emu-alg>
1. If the first |CaseClauses| is present, then
1. Let _hasUndefinedLabels_ be ContainsUndefinedBreakTarget of the first |CaseClauses| with argument _labelSet_.
1. If _hasUndefinedLabels_ is *true*, return *true*.
1. Let _hasUndefinedLabels_ be ContainsUndefinedBreakTarget of |DefaultClause| with argument _labelSet_.
1. If _hasUndefinedLabels_ is *true*, return *true*.
1. If ContainsUndefinedBreakTarget of the first |CaseClauses| with argument _labelSet_ is *true*, return *true*.
1. If ContainsUndefinedBreakTarget of |DefaultClause| with argument _labelSet_ is *true*, return *true*.
1. If the second |CaseClauses| is not present, return *false*.
1. Return ContainsUndefinedBreakTarget of the second |CaseClauses| with argument _labelSet_.
</emu-alg>
Expand Down Expand Up @@ -7131,10 +7125,8 @@ <h1>Static Semantics: ContainsUndefinedBreakTarget</h1>
</emu-alg>
<emu-grammar>TryStatement : `try` Block Catch Finally</emu-grammar>
<emu-alg>
1. Let _hasUndefinedLabels_ be ContainsUndefinedBreakTarget of |Block| with argument _labelSet_.
1. If _hasUndefinedLabels_ is *true*, return *true*.
1. Let _hasUndefinedLabels_ be ContainsUndefinedBreakTarget of |Catch| with argument _labelSet_.
1. If _hasUndefinedLabels_ is *true*, return *true*.
1. If ContainsUndefinedBreakTarget of |Block| with argument _labelSet_ is *true*, return *true*.
1. If ContainsUndefinedBreakTarget of |Catch| with argument _labelSet_ is *true*, return *true*.
1. Return ContainsUndefinedBreakTarget of |Finally| with argument _labelSet_.
</emu-alg>
<emu-grammar>Catch : `catch` `(` CatchParameter `)` Block</emu-grammar>
Expand Down Expand Up @@ -7261,10 +7253,8 @@ <h1>Static Semantics: ContainsUndefinedContinueTarget</h1>
<emu-grammar>CaseBlock : `{` CaseClauses? DefaultClause CaseClauses? `}`</emu-grammar>
<emu-alg>
1. If the first |CaseClauses| is present, then
1. Let _hasUndefinedLabels_ be ContainsUndefinedContinueTarget of the first |CaseClauses| with arguments _iterationSet_ and &laquo; &raquo;.
1. If _hasUndefinedLabels_ is *true*, return *true*.
1. Let _hasUndefinedLabels_ be ContainsUndefinedContinueTarget of |DefaultClause| with arguments _iterationSet_ and &laquo; &raquo;.
1. If _hasUndefinedLabels_ is *true*, return *true*.
1. If ContainsUndefinedContinueTarget of the first |CaseClauses| with arguments _iterationSet_ and &laquo; &raquo; is *true*, return *true*.
1. If ContainsUndefinedContinueTarget of |DefaultClause| with arguments _iterationSet_ and &laquo; &raquo; is *true*, return *true*.
1. If the second |CaseClauses| is not present, return *false*.
1. Return ContainsUndefinedContinueTarget of the second |CaseClauses| with arguments _iterationSet_ and &laquo; &raquo;.
</emu-alg>
Expand Down Expand Up @@ -7308,10 +7298,8 @@ <h1>Static Semantics: ContainsUndefinedContinueTarget</h1>
</emu-alg>
<emu-grammar>TryStatement : `try` Block Catch Finally</emu-grammar>
<emu-alg>
1. Let _hasUndefinedLabels_ be ContainsUndefinedContinueTarget of |Block| with arguments _iterationSet_ and &laquo; &raquo;.
1. If _hasUndefinedLabels_ is *true*, return *true*.
1. Let _hasUndefinedLabels_ be ContainsUndefinedContinueTarget of |Catch| with arguments _iterationSet_ and &laquo; &raquo;.
1. If _hasUndefinedLabels_ is *true*, return *true*.
1. If ContainsUndefinedContinueTarget of |Block| with arguments _iterationSet_ and &laquo; &raquo; is *true*, return *true*.
1. If ContainsUndefinedContinueTarget of |Catch| with arguments _iterationSet_ and &laquo; &raquo; is *true*, return *true*.
1. Return ContainsUndefinedContinueTarget of |Finally| with arguments _iterationSet_ and &laquo; &raquo;.
</emu-alg>
<emu-grammar>Catch : `catch` `(` CatchParameter `)` Block</emu-grammar>
Expand Down Expand Up @@ -11342,7 +11330,7 @@ <h1>[[DefineOwnProperty]] ( _P_, _Desc_ )</h1>
1. If _succeeded_ is *false*, return *false*.
1. If _index_ &ge; _oldLen_, then
1. Set _oldLenDesc_.[[Value]] to _index_ + *1*<sub>𝔽</sub>.
1. Let _succeeded_ be OrdinaryDefineOwnProperty(_A_, *"length"*, _oldLenDesc_).
1. Set _succeeded_ to OrdinaryDefineOwnProperty(_A_, *"length"*, _oldLenDesc_).
1. Assert: _succeeded_ is *true*.
1. Return *true*.
1. Return OrdinaryDefineOwnProperty(_A_, _P_, _Desc_).
Expand Down Expand Up @@ -11420,7 +11408,7 @@ <h1>ArraySetLength ( _A_, _Desc_ )</h1>
1. Perform ! OrdinaryDefineOwnProperty(_A_, *"length"*, _newLenDesc_).
1. Return *false*.
1. If _newWritable_ is *false*, then
1. Let _succeeded_ be ! OrdinaryDefineOwnProperty(_A_, *"length"*, PropertyDescriptor { [[Writable]]: *false* }).
1. Set _succeeded_ to ! OrdinaryDefineOwnProperty(_A_, *"length"*, PropertyDescriptor { [[Writable]]: *false* }).
1. Assert: _succeeded_ is *true*.
1. Return *true*.
</emu-alg>
Expand Down Expand Up @@ -11671,7 +11659,7 @@ <h1>CreateMappedArgumentsObject ( _func_, _formals_, _argumentsList_, _env_ )</h
1. Set _index_ to _index_ + 1.
1. Perform ! DefinePropertyOrThrow(_obj_, *"length"*, PropertyDescriptor { [[Value]]: 𝔽(_len_), [[Writable]]: *true*, [[Enumerable]]: *false*, [[Configurable]]: *true* }).
1. Let _mappedNames_ be a new empty List.
1. Let _index_ be _numberOfParameters_ - 1.
1. Set _index_ to _numberOfParameters_ - 1.
1. Repeat, while _index_ &ge; 0,
1. Let _name_ be _parameterNames_[_index_].
1. If _name_ is not an element of _mappedNames_, then
Expand Down

0 comments on commit a12b4d4

Please sign in to comment.