RESOLVED FIXED 131698
Simple ES6 feature: Array.from
https://bugs.webkit.org/show_bug.cgi?id=131698
Summary Simple ES6 feature: Array.from
Oliver Hunt
Reported 2014-04-15 14:56:36 PDT
Attachments
Radar WebKit Bug Importer
Comment 1 2014-04-15 14:56:51 PDT
Antoine Quint
Comment 2 2014-05-07 10:51:46 PDT
Dupe of 130966, landed in http://trac.webkit.org/changeset/167797. *** This bug has been marked as a duplicate of bug 130966 ***
Antoine Quint
Comment 3 2014-05-07 10:52:30 PDT
Wrong bug, sorry!
Caitlin Potter (:caitp)
Comment 4 2015-01-12 19:18:17 PST
This bug should be simple, but is at least partially blocked on iterators being available.
Oliver Hunt
Comment 5 2015-01-13 08:10:50 PST
We support for-of on all currently iterable types, as well as the spread operator so should be either Return [...arguments] Or Return [...source] I can't recall spec of the top of my head
Caitlin Potter (:caitp)
Comment 6 2015-01-13 15:09:11 PST
You're correct, for-of and the spread operator are supported for certain types (although strings appear to not be iterable yet in JSC). However, iterator methods seem to be attached via private properties / internal slots, rather than using the well-known symbol @@iterator. The Array.from algorithm uses `GetMethod(items, @@iterator)` to determine whether or not it can use the from-iterable path or the from-array-like path, so an implementation is still sort of blocked on that (or at least blocked on exposing a getter for the private iterator properties to JS builtins, if it is to be implemented in JS).
Oliver Hunt
Comment 7 2015-01-13 15:42:48 PST
I would actually say that the hardest part here will be updating the builtins generation logic to support constructor/static functions. The subsequent logic would be to expose (as a private global) the Symbol object, with @@iterator attached. (You'd still need to use for-of. Our internal iterator implementation doesn't match spec behaviour for reasons best summed up as "performance")
Oliver Hunt
Comment 8 2015-01-13 15:45:48 PST
note builtin JS can do magical things - look at the js files in builtins/
Geoffrey Garen
Comment 9 2016-03-14 12:47:08 PDT
This is done.
Geoffrey Garen
Comment 10 2016-03-14 12:47:50 PDT
Note You need to log in before you can comment on or make changes to this bug.