« Bugzilla Issues Index
#208 — Destructuring should work with LeftHandSideExpression
- bug_id:
208
- creation_ts:
2011-09-26 10:31:00 -0700
- short_desc:
Destructuring should work with LeftHandSideExpression
- delta_ts:
2015-07-10 08:34:20 -0700
- product:
Draft for 6th Edition
- component:
technical issue
- version:
Rev 3: September 23, 2011 Draft
- rep_platform:
All
- op_sys:
All
- bug_status:
RESOLVED
- resolution:
INVALID
- priority:
Normal
- bug_severity:
enhancement
- everconfirmed:
true
- reporter:
Erik Arvidsson
- assigned_to:
Allen Wirfs-Brock
- cc:
erik.arvidsson
- commentid:
486
- comment_count:
0
- who:
Erik Arvidsson
- bug_when:
2011-09-26 10:31:47 -0700
SpiderMonkey allows a LeftHandSideExpression and not just a SingleNameBinding on the right hand side of a BindingProperty. The following should work:
var object = {};
({x: object.y}) = {x: 42};
print(object.y); // 42
- commentid:
487
- comment_count:
1
- who:
Allen Wirfs-Brock
- bug_when:
2011-09-26 11:31:16 -0700
The rev 3 draft does allow LeftHandSideExpression to appear as the target of destructuring assignment. See 11.13
It is only binding forms (let, const, var, parameters, etc.) defined in 12.2.4 that require a single name. I believe that this is a valid restriction on binding forms. I don't think we want binding forms to act as as arbitrary assignment statements.
- commentid:
488
- comment_count:
2
- who:
Erik Arvidsson
- bug_when:
2011-09-26 11:39:57 -0700
The draft looks fine. I didn't see the ArrayAssignmentPattern forms.