Skip to content

Safari forOf and spread issues for Set object. #1810

Open
@patrick-martin-shoutpoint

Description

When using the Set object, the following code fails in Safari 8 desktop and mobile:
"Error: undefined is not a function (evaluating 'f.next()')"

var set = new Set([1,2,3,4]);

var arr = [...set]; // FAIL

for (var v of set) // FAIL
  console.log(v);

var vals = set.values();
for (var v of vals) // FAIL
  console.log(v);

Note: This code fails to compile in the Traceur REPL on Safari.
https://google.github.io/traceur-compiler/demo/repl.html#var%20set%20%3D%20new%20Set(%5B1%2C2%2C3%2C4%5D)%3B%0A%0Avar%20arr%20%3D%20%5B...set%5D%3B%0A%0Afor%20(var%20v%20of%20set)%0A%20%20console.log(v)%3B%0A%0Avar%20vals%20%3D%20set.values()%3B%0Afor%20(var%20v%20of%20vals)%0A%20%20console.log(v)%3B%0A

spread@https://google.github.io/traceur-compiler/bin/traceur.js:1316:38

getAnonymousModule@https://google.github.io/traceur-compiler/bin/traceur.js:681:34
eval code
eval@[native code]
evaluateCodeUnit@https://google.github.io/traceur-compiler/bin/traceur.js:29800:36
evaluate@https://google.github.io/traceur-compiler/bin/traceur.js:29956:50
evaluate@https://google.github.io/traceur-compiler/bin/traceur.js:30257:37
handleCodeUnitLoaded@https://google.github.io/traceur-compiler/bin/traceur.js:30170:24
module@https://google.github.io/traceur-compiler/bin/traceur.js:30056:32
module@https://google.github.io/traceur-compiler/bin/traceur.js:30317:41
transcode
compileContents
compile
wrappedFunc

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions