-
-
Notifications
You must be signed in to change notification settings - Fork 5.8k
Closed
Labels
outdatedA closed issue/PR that is archived due to age. Recommended to make a new issueA closed issue/PR that is archived due to age. Recommended to make a new issue
Description
Given the following es6:
function* foo() {
try {
yield someValue;
}
catch (err) {
var obj = {err: err};
}
}6to5@1.3.11 produces the following es5:
"use strict";
var foo = regeneratorRuntime.mark(function foo() {
var obj;
return regeneratorRuntime.wrap(function foo$(_context) {
while (true) switch (_context.prev = _context.next) {
case 0: _context.prev = 0;
_context.next = 3;
return someValue;
case 3: _context.next = 8;
break;
case 5: _context.prev = 5;
_context.t0 = _context["catch"](0);
obj = { _context.t0: _context.t0 };
case 8:
case "end": return _context.stop();
}
}, foo, this, [[0, 5]]);
});The part of the output is problematic:
obj = { _context.t0: _context.t0 };which comes from this line of es6:
var obj = {err: err};The correct output would be:
obj = { err: _context.t0 };Thanks!
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
outdatedA closed issue/PR that is archived due to age. Recommended to make a new issueA closed issue/PR that is archived due to age. Recommended to make a new issue