prepack
prepack copied to clipboard
Prepack emits yield outside of generator function
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);
I guess the fix is to retain the generator marker as appropriate when synthesizing new Babel function instances for residual functions.