Skip to content

Commit

Permalink
refactor: code
Browse files Browse the repository at this point in the history
  • Loading branch information
snitin315 committed Apr 26, 2021
1 parent 905f7f8 commit 16e82c2
Showing 1 changed file with 4 additions and 14 deletions.
18 changes: 4 additions & 14 deletions packages/babel-traverse/src/path/conversion.ts
Expand Up @@ -236,20 +236,10 @@ function hoistFunctionEnvironment(
);

argumentsPaths.forEach(argumentsChild => {
let currentScope = argumentsChild.scope;
do {
if (
!currentScope.hasOwnBinding("arguments") &&
!(
currentScope.path.isFunction() &&
!currentScope.path.isArrowFunctionExpression()
)
) {
const argsRef = t.identifier(argumentsBinding);
argsRef.loc = argumentsChild.node.loc;
argumentsChild.replaceWith(argsRef);
}
} while ((currentScope = currentScope.parent));
const argsRef = t.identifier(argumentsBinding);
argsRef.loc = argumentsChild.node.loc;

argumentsChild.replaceWith(argsRef);
});
}

Expand Down

0 comments on commit 16e82c2

Please sign in to comment.