@babel/plugin-transform-block-scoping
Advanced tools
Comparing version 7.14.5 to 7.15.3
@@ -188,9 +188,8 @@ "use strict"; | ||
enter(path, self) { | ||
const { | ||
node, | ||
parent | ||
} = path; | ||
if (path.isForStatement()) { | ||
const { | ||
node | ||
} = path; | ||
if (path.isForStatement()) { | ||
if (isVar(node.init, node)) { | ||
if (isVar(node.init)) { | ||
const nodes = self.pushDeclar(node.init); | ||
@@ -204,9 +203,13 @@ | ||
} | ||
} else if (path.isFor()) { | ||
if (isVar(node.left, node)) { | ||
} else if (path.isForInStatement() || path.isForOfStatement()) { | ||
const { | ||
node | ||
} = path; | ||
if (isVar(node.left)) { | ||
self.pushDeclar(node.left); | ||
node.left = node.left.declarations[0].id; | ||
} | ||
} else if (isVar(node, parent)) { | ||
path.replaceWithMultiple(self.pushDeclar(node).map(expr => _core.types.expressionStatement(expr))); | ||
} else if (isVar(path.node)) { | ||
path.replaceWithMultiple(self.pushDeclar(path.node).map(expr => _core.types.expressionStatement(expr))); | ||
} else if (path.isFunction()) { | ||
@@ -282,2 +285,6 @@ return path.skip(); | ||
if (loopText) { | ||
if (_core.types.isReturnStatement(node)) { | ||
throw new Error("Internal error: unexpected return statement with `loopText`"); | ||
} | ||
if (node.label) { | ||
@@ -299,3 +306,3 @@ if (state.innerLabels.indexOf(node.label.name) >= 0) { | ||
if (path.isReturnStatement()) { | ||
if (_core.types.isReturnStatement(node)) { | ||
state.hasReturn = true; | ||
@@ -329,2 +336,18 @@ replace = _core.types.objectExpression([_core.types.objectProperty(_core.types.identifier("v"), node.argument || scope.buildUndefinedNode())]); | ||
constructor(loopPath, blockPath, parent, scope, throwIfClosureRequired, tdzEnabled, state) { | ||
this.parent = void 0; | ||
this.state = void 0; | ||
this.scope = void 0; | ||
this.throwIfClosureRequired = void 0; | ||
this.tdzEnabled = void 0; | ||
this.blockPath = void 0; | ||
this.block = void 0; | ||
this.outsideLetReferences = void 0; | ||
this.hasLetReferences = void 0; | ||
this.letReferences = void 0; | ||
this.body = void 0; | ||
this.loopParent = void 0; | ||
this.loopLabel = void 0; | ||
this.loopPath = void 0; | ||
this.loop = void 0; | ||
this.has = void 0; | ||
this.parent = parent; | ||
@@ -331,0 +354,0 @@ this.scope = scope; |
{ | ||
"name": "@babel/plugin-transform-block-scoping", | ||
"version": "7.14.5", | ||
"version": "7.15.3", | ||
"description": "Compile ES2015 block scoping (const and let) to ES5", | ||
@@ -26,4 +26,5 @@ "repository": { | ||
"devDependencies": { | ||
"@babel/core": "7.14.5", | ||
"@babel/helper-plugin-test-runner": "7.14.5" | ||
"@babel/core": "7.15.0", | ||
"@babel/helper-plugin-test-runner": "7.14.5", | ||
"@babel/traverse": "7.15.0" | ||
}, | ||
@@ -30,0 +31,0 @@ "engines": { |
27172
698
3