Avoid duplicated identifier sharing location - fixes T7436

This commit is contained in:
Logan Smyth
2016-07-18 20:49:14 -07:00
parent a1c2d4dd5d
commit ea426baa07
4 changed files with 22 additions and 1 deletions

View File

@@ -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(