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
function *fn(){
(yield 1)(yield 2)(yield 3);
}
var gen = fn();
console.log('a', gen.next());
console.log('b', gen.next());
console.log('c', gen.next());
console.log('d', gen.next());
will throw when executing d because all yields are processed before attempting to call the functions, whereas the expectation is that it would throw when processing c.
The output currently is
case 0:
context$1$0.next = 2;
return 1;
case 2:
context$1$0.next = 4;
return 2;
case 4:
context$1$0.t0 = context$1$0.sent;
context$1$0.next = 7;
return 3;
case 7:
context$1$0.t1 = context$1$0.sent;
(0, context$1$0.sent)(context$1$0.t0)(context$1$0.t1);
where really the first call should be in the earlier case.
Thanks for the report. I think I can fix this, but I'd prefer to wait until Babel and Regenerator are using the same code, as we've discussed elsewhere :)
will throw when executing
d
because allyield
s are processed before attempting to call the functions, whereas the expectation is that it would throw when processingc
.The output currently is
where really the first call should be in the earlier
case
.Originally raised on Babel's side in http://stackoverflow.com/questions/36958171/es6-yield-yield-1yield-2yield-3 but raising here.
The text was updated successfully, but these errors were encountered: