Skip to content

Commit

Permalink
improve
Browse files Browse the repository at this point in the history
  • Loading branch information
liuxingbaoyu committed Sep 23, 2023
1 parent 61b2cee commit 7da248f
Showing 1 changed file with 1 addition and 7 deletions.
8 changes: 1 addition & 7 deletions packages/babel-helper-wrap-function/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -255,10 +255,8 @@ export default function wrapFunction(
let built = node;
if (!isCallExpression(node)) {
functionId = node.id;
node.id = null;
node.type = "FunctionExpression";
built = callExpression(path.hub.addHelper(callAsync), [
node as t.FunctionExpression,
functionExpression(null, node.params, node.body, node.generator),
identifier("this"),
identifier("arguments"),
]);
Expand Down Expand Up @@ -292,10 +290,6 @@ export default function wrapFunction(
wrapper.id ||
(!ignoreFunctionLength && params.length)
) {
// Because we previously mutated some `FunctionDeclaration` nodes to `FunctionExpression`.
path.type = isDeclaration
? "FunctionDeclaration"
: "FunctionExpression";
path.replaceWith(wrapper);
markCallWrapped(path);
} else {
Expand Down

0 comments on commit 7da248f

Please sign in to comment.