Merge pull request #3586 from loganfsmyth/fix-retainLines-generator-issue
Avoid duplicated identifier sharing location - fixes T7436
This commit is contained in:
commit
ab47b439cc
@ -26,7 +26,9 @@ exports.hoist = function(funPath) {
|
||||
let exprs = [];
|
||||
|
||||
vdec.declarations.forEach(function(dec) {
|
||||
vars[dec.id.name] = dec.id;
|
||||
// Note: We duplicate 'dec.id' here to ensure that the variable declaration IDs don't
|
||||
// have the same 'loc' value, since that can make sourcemaps and retainLines behave poorly.
|
||||
vars[dec.id.name] = t.identifier(dec.id.name);
|
||||
|
||||
if (dec.init) {
|
||||
exprs.push(t.assignmentExpression(
|
||||
|
||||
@ -0,0 +1,7 @@
|
||||
var func = function * (){
|
||||
yield obj
|
||||
.method()
|
||||
.method2();
|
||||
|
||||
const actual = true;
|
||||
};
|
||||
@ -0,0 +1,6 @@
|
||||
var func = regeneratorRuntime.mark(function _callee() {var actual;return regeneratorRuntime.wrap(function _callee$(_context) {while (1) switch (_context.prev = _context.next) {case 0:_context.next = 2;return (
|
||||
obj.
|
||||
method().
|
||||
method2());case 2:
|
||||
|
||||
actual = true;case 3:case "end":return _context.stop();}}, _callee, this);});
|
||||
@ -0,0 +1,6 @@
|
||||
{
|
||||
"plugins": [
|
||||
"transform-regenerator"
|
||||
],
|
||||
"retainLines": true
|
||||
}
|
||||
Loading…
x
Reference in New Issue
Block a user