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:
parent
17f4195bcc
commit
f195daa092
@ -49,10 +49,7 @@ export default function splitExportDeclaration(exportDeclaration) {
|
|||||||
exportDeclaration.replaceWith(updatedDeclaration);
|
exportDeclaration.replaceWith(updatedDeclaration);
|
||||||
|
|
||||||
if (needBindingRegistration) {
|
if (needBindingRegistration) {
|
||||||
scope.registerBinding(
|
scope.registerDeclaration(exportDeclaration);
|
||||||
isClassDeclaration ? "let" : "var",
|
|
||||||
exportDeclaration,
|
|
||||||
);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return exportDeclaration;
|
return exportDeclaration;
|
||||||
|
|||||||
@ -0,0 +1,3 @@
|
|||||||
|
import x from './x';
|
||||||
|
|
||||||
|
export default function(x) {}
|
||||||
@ -0,0 +1,3 @@
|
|||||||
|
{
|
||||||
|
"plugins": ["transform-modules-commonjs"]
|
||||||
|
}
|
||||||
12
packages/babel-plugin-transform-modules-commonjs/test/fixtures/regression/issue-9611/output.js
vendored
Normal file
12
packages/babel-plugin-transform-modules-commonjs/test/fixtures/regression/issue-9611/output.js
vendored
Normal 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) {}
|
||||||
@ -518,7 +518,7 @@ export default class Scope {
|
|||||||
}
|
}
|
||||||
|
|
||||||
const parent = this.getProgramParent();
|
const parent = this.getProgramParent();
|
||||||
const ids = path.getBindingIdentifiers(true);
|
const ids = path.getOuterBindingIdentifiers(true);
|
||||||
|
|
||||||
for (const name of Object.keys(ids)) {
|
for (const name of Object.keys(ids)) {
|
||||||
for (const id of (ids[name]: Array<Object>)) {
|
for (const id of (ids[name]: Array<Object>)) {
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user