Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

CallExpression not processed in correct order in complex case #244

Closed
loganfsmyth opened this issue May 1, 2016 · 3 comments
Closed

CallExpression not processed in correct order in complex case #244

loganfsmyth opened this issue May 1, 2016 · 3 comments
Assignees

Comments

@loganfsmyth
Copy link
Contributor

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.

Originally raised on Babel's side in http://stackoverflow.com/questions/36958171/es6-yield-yield-1yield-2yield-3 but raising here.

@benjamn benjamn self-assigned this May 3, 2016
@benjamn
Copy link
Collaborator

benjamn commented May 3, 2016

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 :)

@benjamn
Copy link
Collaborator

benjamn commented May 3, 2016

That said, if this is causing severe problems for lots of folks, I can prioritize it higher/sooner.

@loganfsmyth
Copy link
Contributor Author

Seems low priority and pretty edge-casey to me, I just didn't want it to get lost and forgotten on StackOverflow.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants