From 81dd5ed8153c43b2f57e10df8ccf1cbc63e8c009 Mon Sep 17 00:00:00 2001 From: Daniel Ehrenberg Date: Wed, 28 Jun 2017 15:03:15 +0200 Subject: [PATCH] Normative: Disallow nested destructuring assignment with rest properties Follow-up for #43 --- Spec.html | 19 ++++++++++++------- 1 file changed, 12 insertions(+), 7 deletions(-) diff --git a/Spec.html b/Spec.html index 86652d4..88cf69a 100644 --- a/Spec.html +++ b/Spec.html @@ -125,6 +125,15 @@

Runtime Semantics: DestructuringAssignmentEvaluation

+ +

Static Semantics: Early Errors

+ + AssignmentRestProperty[Yield, Await] : + `...` DestructuringAssignmentTarget[Yield, Await] + +
  • It is a Syntax Error if |DestructuringAssignmentTarget| is an |ArrayLiteral| or an |ObjectLiteral|.
+
+

Runtime Semantics: PropertyDestructuringAssignmentEvaluation

With parameters _value_.

@@ -174,16 +183,12 @@

Runtime Semantics: RestDestructuringAssignmentEvaluation

AssignmentRestProperty[Yield, Await] : `...` DestructuringAssignmentTarget - 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_).