Merge pull request #3433 from loganfsmyth/bail-out-rename

Only attempt to rename export declarations, not expressions - fixes T7215
This commit is contained in:
Logan Smyth 2016-04-06 19:04:21 -07:00
commit 2d0a007d14
4 changed files with 23 additions and 1 deletions

View File

@ -0,0 +1,5 @@
export default (onClick) => ({
onClick: function(){
onClick(text);
},
});

View File

@ -0,0 +1,13 @@
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.default = function (_onClick) {
return {
onClick: function onClick() {
_onClick(text);
}
};
};

View File

@ -0,0 +1,4 @@
{
"presets": ["es2015"],
"plugins": ["external-helpers"]
}

View File

@ -105,7 +105,7 @@ export default class Renamer {
let { binding, oldName, newName } = this;
let { scope, path } = binding;
let parentDeclar = path.find((path) => path.isDeclaration() || path.isFunctionExpression());
let parentDeclar = path.find((path) => path.isDeclaration());
if (parentDeclar) {
this.maybeConvertFromExportDeclaration(parentDeclar);
}