Closed Bug 1040699 Opened 5 years ago Closed 5 years ago

Remove "group assignment" optimization in destructuring assignment

Categories

(Core :: JavaScript Engine, defect)

x86_64
Linux
defect
Not set

Tracking

()

RESOLVED FIXED
mozilla34

People

(Reporter: Swatinem, Assigned: Swatinem)

References

Details

Attachments

(1 file)

From bug 933276 comment 21:

(In reply to Jason Orendorff [:jorendorff] from comment #21)
> Arpad, I just realized it's necessary to delete the "group assignment"
> optimization.
> 
> Try this and you'll see what I mean:
> 
> js> delete Array.prototype["@@iterator"];
> js> (function () { var [x, y] = [1, 2]; })() // should throw TypeError
> because Array#@@iterator is gone
> js> dis(function () { var [x, y] = [1, 2]; })
> 
> 
> Fortunately that should be very easy to delete. Please do it in a separate
> patch though, preferably *under* (before) this patch.

Right now, we have a special "group assignment" optimization that is triggered when we have an ArrayPattern on the LHS and an ArrayLiteral on the RHS.

Bug 933276 will move destructuring assignment over to use @@iterator, as specified in ES6, which collides with this optimization.
Removing it and always using the normal destructuring code should make moving to @@iterator a lot easier.
Comment on attachment 8459138 [details] [diff] [review]
Remove "group assignment" optimization in destructuring assignment

Review of attachment 8459138 [details] [diff] [review]:
-----------------------------------------------------------------

Thank you.
Attachment #8459138 - Flags: review?(jorendorff) → review+
https://hg.mozilla.org/mozilla-central/rev/3b2046d81e35
Status: ASSIGNED → RESOLVED
Closed: 5 years ago
Flags: in-testsuite+
Resolution: --- → FIXED
Target Milestone: --- → mozilla34
You need to log in before you can comment on or make changes to this bug.