@babel/plugin-transform-block-scoping
Advanced tools
Comparing version 7.24.1 to 7.24.4
@@ -41,10 +41,10 @@ "use strict"; | ||
bodyScope = body.scope; | ||
const bindings = (0, _loop.getLoopBodyBindings)(path); | ||
for (const binding of bindings) { | ||
const { | ||
capturedInClosure | ||
} = (0, _loop.getUsageInBody)(binding, path); | ||
if (capturedInClosure) markNeedsBodyWrap(); | ||
} | ||
} | ||
const bindings = (0, _loop.getLoopBodyBindings)(path); | ||
for (const binding of bindings) { | ||
const { | ||
capturedInClosure | ||
} = (0, _loop.getUsageInBody)(binding, path); | ||
if (capturedInClosure) markNeedsBodyWrap(); | ||
} | ||
const captured = []; | ||
@@ -51,0 +51,0 @@ const updatedBindingsUsages = new Map(); |
@@ -193,13 +193,10 @@ "use strict"; | ||
assign.push(_core.types.assignmentExpression("=", decl.id, decl.init)); | ||
} else if (_core.types.isForXStatement(varPath.parent, { | ||
left: varPath.node | ||
})) { | ||
assign.push(decl.id); | ||
} | ||
} | ||
if (assign.length > 0) { | ||
let replacement = assign.length === 1 ? assign[0] : _core.types.sequenceExpression(assign); | ||
if (!_core.types.isForStatement(varPath.parent, { | ||
init: varPath.node | ||
}) && !_core.types.isForXStatement(varPath.parent, { | ||
left: varPath.node | ||
})) { | ||
replacement = _core.types.expressionStatement(replacement); | ||
} | ||
const replacement = assign.length === 1 ? assign[0] : _core.types.sequenceExpression(assign); | ||
varPath.replaceWith(replacement); | ||
@@ -206,0 +203,0 @@ } else { |
{ | ||
"name": "@babel/plugin-transform-block-scoping", | ||
"version": "7.24.1", | ||
"version": "7.24.4", | ||
"description": "Compile ES2015 block scoping (const and let) to ES5", | ||
@@ -26,3 +26,3 @@ "repository": { | ||
"devDependencies": { | ||
"@babel/core": "^7.24.1", | ||
"@babel/core": "^7.24.4", | ||
"@babel/helper-plugin-test-runner": "^7.24.1", | ||
@@ -29,0 +29,0 @@ "@babel/traverse": "^7.24.1" |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
88140
700