Skip to content

Commit

Permalink
Normative: Disallow nested destructuring assignment with rest properties
Browse files Browse the repository at this point in the history
Follow-up for tc39#43
  • Loading branch information
littledan committed Jun 28, 2017
1 parent ad13fdb commit 81dd5ed
Showing 1 changed file with 12 additions and 7 deletions.
19 changes: 12 additions & 7 deletions Spec.html
Original file line number Diff line number Diff line change
Expand Up @@ -125,6 +125,15 @@ <h1>Runtime Semantics: DestructuringAssignmentEvaluation</h1>
</emu-clause>

<ins class="block">
<emu-clause id="nested-rest-prohibition">
<h1>Static Semantics: Early Errors</h1>
<emu-grammar>
AssignmentRestProperty[Yield, Await] :
`...` DestructuringAssignmentTarget[Yield, Await]
</emu-grammar>
<ul><li>It is a Syntax Error if |DestructuringAssignmentTarget| is an |ArrayLiteral| or an |ObjectLiteral|.</li></ul>
</emu-clause>

<emu-clause id="Rest-RuntimeSemantics-PropertyDestructuringAssignmentEvaluation">
<h1>Runtime Semantics: PropertyDestructuringAssignmentEvaluation</h1>
<p>With parameters _value_.</p>
Expand Down Expand Up @@ -174,16 +183,12 @@ <h1>Runtime Semantics: RestDestructuringAssignmentEvaluation</h1>

<emu-grammar>AssignmentRestProperty[Yield, Await] : `...` DestructuringAssignmentTarget</emu-grammar>
<emu-alg>
1. If |DestructuringAssignmentTarget| is neither an |ObjectLiteral| nor an |ArrayLiteral|, then
1. Let _lref_ be the result of evaluating |DestructuringAssignmentTarget|.
1. ReturnIfAbrupt(_lref_).
1. Let _lref_ be the result of evaluating |DestructuringAssignmentTarget|.
1. ReturnIfAbrupt(_lref_).
1. Let _restObj_ be ObjectCreate(%ObjectPrototype%).
1. Let _assignStatus_ be CopyDataProperties(_restObj_, _value_, _excludedNames_).
1. ReturnIfAbrupt(_assignStatus_).
1. If |DestructuringAssignmentTarget| is neither an |ObjectLiteral| nor an |ArrayLiteral|, then
1. Return PutValue(_lref_, _restObj_).
1. Let _nestedAssignmentPattern_ be the parse of the source text corresponding to |DestructuringAssignmentTarget| using either |AssignmentPattern[?Yield, ?Await]| as the goal symbol, adopting the parameter values from |AssignmentRestProperty|.
1. Return the result of performing DestructuringAssignmentEvaluation of _nestedAssignmentPattern_ with _restObj_ as the argument.
1. Return PutValue(_lref_, _restObj_).
</emu-alg>
</emu-clause>
</ins>
Expand Down

0 comments on commit 81dd5ed

Please sign in to comment.