| Summary: | Simple ES6 feature: Array.from | ||
|---|---|---|---|
| Product: | WebKit | Reporter: | Oliver Hunt <oliver> |
| Component: | JavaScriptCore | Assignee: | Nobody <webkit-unassigned> |
| Status: | RESOLVED FIXED | ||
| Severity: | Normal | CC: | caitp, ggaren, graouts, m.goleb+bugzilla, webkit-bug-importer |
| Priority: | P2 | Keywords: | EasyFix, InRadar |
| Version: | 528+ (Nightly build) | ||
| Hardware: | Unspecified | ||
| OS: | Unspecified | ||
|
Description
Oliver Hunt
2014-04-15 14:56:36 PDT
Dupe of 130966, landed in http://trac.webkit.org/changeset/167797. *** This bug has been marked as a duplicate of bug 130966 *** Wrong bug, sorry! This bug should be simple, but is at least partially blocked on iterators being available. 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 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). 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") note builtin JS can do magical things - look at the js files in builtins/ This is done. |