Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(40)

Issue 1704533002: Support rest element pattern with user-defined iterable (Closed)

Created:
4 years, 10 months ago by mike3
Modified:
4 years, 8 months ago
Reviewers:
adamk
CC:
v8-reviews_googlegroups.com
Base URL:
https://chromium.googlesource.com/v8/v8.git@master
Target Ref:
refs/pending/heads/master
Project:
v8
Visibility:
Public.

Description

Support rest element pattern with user-defined iterable The original implementation incorrectly supplied an iterator (not an iterable) to a `for-of` statement. This functioned as expected for built-in iterators because (by inheriting the InteratorPrototype intrinsic's `Symbol.iterator` method) they are technically iterables as well. This is not part of the formal Iterator interface requirements, however, and user-created iterators that did not define a `Symbol.iterator` property would produce an error when used as the value for an AssignmentRestElement or BindingRestElement. Update the internals to interpret the value as an iterator. BUG=v8:4759 LOG=N R=adamk@chromium.org

Patch Set 1 #

Unified diffs Side-by-side diffs Delta from patch set Stats (+52 lines, -5 lines) Patch
M src/contexts.h View 1 chunk +1 line, -1 line 0 comments Download
M src/js/runtime.js View 3 chunks +5 lines, -2 lines 0 comments Download
M src/parsing/pattern-rewriter.cc View 2 chunks +2 lines, -2 lines 0 comments Download
M test/mjsunit/harmony/destructuring.js View 1 chunk +22 lines, -0 lines 0 comments Download
M test/mjsunit/harmony/destructuring-assignment.js View 1 chunk +22 lines, -0 lines 0 comments Download

Messages

Total messages: 9 (1 generated)
mike3
4 years, 10 months ago (2016-02-16 16:23:39 UTC) #1
mike3
An alternative would be to avoid using `for-of` altogether and manually step through the iterator ...
4 years, 10 months ago (2016-02-16 16:30:21 UTC) #2
caitp (gmail)
On 2016/02/16 16:30:21, mike3 wrote: > An alternative would be to avoid using `for-of` altogether ...
4 years, 10 months ago (2016-02-16 17:24:38 UTC) #3
adamk
As caitp says, the plan of record here is to desugar this fully in the ...
4 years, 10 months ago (2016-02-16 19:59:05 UTC) #4
mike3
On 2016/02/16 19:59:05, adamk wrote: > As caitp says, the plan of record here is ...
4 years, 10 months ago (2016-02-16 20:06:24 UTC) #5
adamk
On 2016/02/16 20:06:24, mike3 wrote: > On 2016/02/16 19:59:05, adamk wrote: > > As caitp ...
4 years, 10 months ago (2016-02-16 22:46:36 UTC) #6
mike3
On 2016/02/16 22:46:36, adamk wrote: > On 2016/02/16 20:06:24, mike3 wrote: > > On 2016/02/16 ...
4 years, 10 months ago (2016-02-16 23:06:58 UTC) #7
mike3
4 years, 8 months ago (2016-04-05 14:00:16 UTC) #9
Message was sent while issue was closed.
It looks like a project maintainer has stepped in to re-implement this patch in
the style suggested by Adam:

https://codereview.chromium.org/1852703002

I regret not having the understanding to do this on my own, but I hope that in
the future, I could work more closely with the maintainers to learn and to
avoid duplicating effort. In any case, I'm glad the bug is fixed!

Powered by Google App Engine
This is Rietveld 408576698