@babel/plugin-transform-block-scoping
Advanced tools
Comparing version 7.12.11 to 7.12.12
@@ -311,2 +311,14 @@ "use strict"; | ||
function isStrict(path) { | ||
return !!path.find(({ | ||
node | ||
}) => { | ||
if (_core.types.isProgram(node)) { | ||
if (node.sourceType === "module") return true; | ||
} else if (!_core.types.isBlockStatement(node)) return false; | ||
return node.directives.some(directive => directive.value.value === "use strict"); | ||
}); | ||
} | ||
class BlockScoping { | ||
@@ -425,3 +437,3 @@ constructor(loopPath, blockPath, parent, scope, throwIfClosureRequired, tdzEnabled, state) { | ||
if (binding.kind === "hoisted" && (!parentBinding || isVar(parentBinding.path.parent))) { | ||
if (binding.kind === "hoisted" && !binding.path.node.async && !binding.path.node.generator && (!parentBinding || isVar(parentBinding.path.parent)) && !isStrict(binding.path.parentPath)) { | ||
continue; | ||
@@ -428,0 +440,0 @@ } |
{ | ||
"name": "@babel/plugin-transform-block-scoping", | ||
"version": "7.12.11", | ||
"version": "7.12.12", | ||
"description": "Compile ES2015 block scoping (const and let) to ES5", | ||
@@ -5,0 +5,0 @@ "repository": { |
25191
657