Make .insert{Before,After} work by default when the parent is an eport declaration (#7040)

This commit is contained in:
Nicolò Ribaudo
2017-12-19 00:05:29 +01:00
committed by GitHub
parent 17b37b5013
commit 68476b6ddd
6 changed files with 88 additions and 38 deletions

View File

@@ -89,11 +89,8 @@ function plainFunction(path: NodePath, callId: Object) {
});
if (isDeclaration) {
const basePath = path.parentPath.isExportDeclaration()
? path.parentPath
: path;
basePath.insertAfter(container[1]);
path.replaceWith(container[0]);
path.insertAfter(container[1]);
} else {
const retFunction = container.callee.body.body[1].argument;
if (!functionId) {