Don't add params of anonymous exported function decls to the outer scope (#9613)

* Don't add params of anonymous exported function decls to the outer scope

* Test
This commit is contained in:
Nicolò Ribaudo 2019-03-01 00:09:49 +01:00 committed by GitHub
parent 17f4195bcc
commit f195daa092
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
5 changed files with 20 additions and 5 deletions

View File

@ -49,10 +49,7 @@ export default function splitExportDeclaration(exportDeclaration) {
exportDeclaration.replaceWith(updatedDeclaration);
if (needBindingRegistration) {
scope.registerBinding(
isClassDeclaration ? "let" : "var",
exportDeclaration,
);
scope.registerDeclaration(exportDeclaration);
}
return exportDeclaration;

View File

@ -0,0 +1,3 @@
import x from './x';
export default function(x) {}

View File

@ -0,0 +1,3 @@
{
"plugins": ["transform-modules-commonjs"]
}

View File

@ -0,0 +1,12 @@
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.default = _default;
var _x = _interopRequireDefault(require("./x"));
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
function _default(x) {}

View File

@ -518,7 +518,7 @@ export default class Scope {
}
const parent = this.getProgramParent();
const ids = path.getBindingIdentifiers(true);
const ids = path.getOuterBindingIdentifiers(true);
for (const name of Object.keys(ids)) {
for (const id of (ids[name]: Array<Object>)) {