Skip to content

Commit

Permalink
Improve performance (#13376)
Browse files Browse the repository at this point in the history
  • Loading branch information
sokra committed May 27, 2021
1 parent 4ee6a27 commit dbfa877
Showing 1 changed file with 8 additions and 2 deletions.
10 changes: 8 additions & 2 deletions packages/babel-plugin-transform-block-scoping/src/index.js
Expand Up @@ -750,7 +750,7 @@ class BlockScoping {
getLetReferences() {
const block = this.block;

let declarators = [];
const declarators = [];

if (this.loop) {
const init = this.loop.left || this.loop.init;
Expand All @@ -773,7 +773,13 @@ class BlockScoping {
if (isBlockScoped(node)) {
convertBlockScopedToVar(path, node, block, this.scope);
}
declarators = declarators.concat(node.declarations || node);
if (node.declarations) {
for (let i = 0; i < node.declarations.length; i++) {
declarators.push(node.declarations[i]);
}
} else {
declarators.push(node);
}
}
if (t.isLabeledStatement(node)) {
addDeclarationsFromChild(path.get("body"), node.body);
Expand Down

0 comments on commit dbfa877

Please sign in to comment.