for (let i of new F) {} not valid syntax?

30 views
Skip to first unread message

raul.m...@gmail.com

unread,
Feb 18, 2015, 8:27:52 AM2/18/15
to traceur-comp...@googlegroups.com
Hello,

If I write

<code>
class C {
* [Symbol.iterator]() {
yield 1;
yield 2;
yield 3;
    }
}

for (let i of new C) {
console.log(i);
}
</code>

without adding the parentheses where I'm calling new C, I get "undefined is not a function".

The same if I write

<code>
function F() {
return (function *() {
yield 1;
yield 2;
})();
}

for (let i of new F) {
console.log(i);
}
</code>

If I add the parentheses it's OK.

Is the syntax without parentheses wrong in for-of?

Thank you,
Raul

raul.m...@gmail.com

unread,
Feb 18, 2015, 9:10:09 AM2/18/15
to traceur-comp...@googlegroups.com
I see that in FF, the second example works, but I don't know how up to date FF is.

Erik Arvidsson

unread,
Feb 18, 2015, 10:10:21 AM2/18/15
to traceur-comp...@googlegroups.com
This is a bug in Traceur. We need to add parens.

On Wed, Feb 18, 2015 at 9:10 AM, <raul.m...@gmail.com> wrote:
> I see that in FF, the second example works, but I don't know how up to date
> FF is.
>
> --
> You received this message because you are subscribed to the Google Groups
> "traceur-compiler-discuss" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to traceur-compiler-d...@googlegroups.com.
> For more options, visit https://groups.google.com/d/optout.



--
erik

Erik Arvidsson

unread,
Feb 18, 2015, 10:27:15 AM2/18/15
to traceur-comp...@googlegroups.com
Reply all
Reply to author
Forward
0 new messages