You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Generators in REPL can't be specified using function *gen() {} #9850
As you can see in the attached image, generators can only be specified with the star placed right next to the function keyword, as if it is placed in another place (right before the function name for example), it enters in multi-line edition mode.
Activity
not-an-aardvark commentedon Nov 30, 2016
It looks like this affects v6+, but not v4.
princejwesley commentedon Nov 30, 2016
@not-an-aardvark its a preprocess issue
princejwesley commentedon Nov 30, 2016
@not-an-aardvark this may help
not-an-aardvark commentedon Nov 30, 2016
@princejwesley Thanks, that's very helpful. However, I think your diff fails with:
because whitespace is not required before/after a generator star.
I think I have a fix; I'll make a PR shortly.
princejwesley commentedon Nov 30, 2016
@not-an-aardvark Remember to land your PR after this
not-an-aardvark commentedon Nov 30, 2016
While fixing this, I noticed another bug:
This is a SyntaxError in the REPL, but it's valid JS. It occurs because it gets preprocessed to
...which is a syntax error.
To fix this, we need to put a semicolon after the
var foo = function foo() {}declaration. I'll add another commit to the PR.princejwesley commentedon Nov 30, 2016
@not-an-aardvark User input can be a partial/multi-line function. We can't insert semicolon here. Here is one more edge case
not-an-aardvark commentedon Nov 30, 2016
Ah, good point. Okay, I'll just submit the PR with the generator function fix then.
repl: fix generator function preprocessing
repl: fix generator function preprocessing
repl: fix generator function preprocessing
repl: fix generator function preprocessing