Skip to content
This repository has been archived by the owner on Feb 12, 2022. It is now read-only.

Prepack emits yield outside of generator function #2294

Open
calebmer opened this issue Jul 18, 2018 · 1 comment
Open

Prepack emits yield outside of generator function #2294

calebmer opened this issue Jul 18, 2018 · 1 comment

Comments

@calebmer
Copy link
Contributor

calebmer commented Jul 18, 2018

Input

"use strict";

var object = {
  *["a"]() {
    yield 1;
    yield 2;
  },
};

var x = Object.keys(object);

Output

"use strict";

var x, object;
(function () {
  var _$0 = this;

  var _3 = function () {
    yield 1; // <---------------------------------- Yield outside of generator!
    yield 2;
  };

  _$0.object = {
    a: _3
  };
  _$0.x = ["a"];
}).call(this);
@NTillmann
Copy link
Contributor

I guess the fix is to retain the generator marker as appropriate when synthesizing new Babel function instances for residual functions.

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

No branches or pull requests

2 participants