@babel/plugin-transform-block-scoping
Advanced tools
Comparing version 7.0.0-beta.32 to 7.0.0-beta.33
@@ -222,2 +222,4 @@ "use strict"; | ||
} | ||
} else if (path.isReturnStatement()) { | ||
state.returnStatements.push(path); | ||
} | ||
@@ -482,4 +484,7 @@ } | ||
_proto.addContinuations = function addContinuations(fn) { | ||
var _this = this; | ||
var state = { | ||
reassignments: {}, | ||
returnStatements: [], | ||
outsideReferences: this.outsideLetReferences | ||
@@ -489,9 +494,22 @@ }; | ||
for (var i = 0; i < fn.params.length; i++) { | ||
var _loop = function _loop(i) { | ||
var param = fn.params[i]; | ||
if (!state.reassignments[param.name]) continue; | ||
var newParam = this.scope.generateUidIdentifier(param.name); | ||
if (!state.reassignments[param.name]) return "continue"; | ||
var newParam = _this.scope.generateUidIdentifier(param.name); | ||
fn.params[i] = newParam; | ||
this.scope.rename(param.name, newParam.name, fn); | ||
_this.scope.rename(param.name, newParam.name, fn); | ||
state.returnStatements.forEach(function (returnStatement) { | ||
returnStatement.insertBefore(_core.types.expressionStatement(_core.types.assignmentExpression("=", param, newParam))); | ||
}); | ||
fn.body.body.push(_core.types.expressionStatement(_core.types.assignmentExpression("=", param, newParam))); | ||
}; | ||
for (var i = 0; i < fn.params.length; i++) { | ||
var _ret = _loop(i); | ||
if (_ret === "continue") continue; | ||
} | ||
@@ -501,3 +519,3 @@ }; | ||
_proto.getLetReferences = function getLetReferences() { | ||
var _this = this; | ||
var _this2 = this; | ||
@@ -521,3 +539,3 @@ var block = this.block; | ||
if (isBlockScoped(node)) { | ||
convertBlockScopedToVar(path, node, block, _this.scope); | ||
convertBlockScopedToVar(path, node, block, _this2.scope); | ||
} | ||
@@ -569,3 +587,3 @@ | ||
addHelper: function addHelper(name) { | ||
return _this.addHelper(name); | ||
return _this2.addHelper(name); | ||
} | ||
@@ -572,0 +590,0 @@ }; |
{ | ||
"name": "@babel/plugin-transform-block-scoping", | ||
"version": "7.0.0-beta.32", | ||
"version": "7.0.0-beta.33", | ||
"description": "Compile ES2015 block scoping (const and let) to ES5", | ||
@@ -15,8 +15,8 @@ "repository": "https://github.com/babel/babel/tree/master/packages/babel-plugin-transform-block-scoping", | ||
"peerDependencies": { | ||
"@babel/core": "7.0.0-beta.32" | ||
"@babel/core": "7.0.0-beta.33" | ||
}, | ||
"devDependencies": { | ||
"@babel/core": "7.0.0-beta.32", | ||
"@babel/helper-plugin-test-runner": "7.0.0-beta.32" | ||
"@babel/core": "7.0.0-beta.33", | ||
"@babel/helper-plugin-test-runner": "7.0.0-beta.33" | ||
} | ||
} |
@@ -43,3 +43,3 @@ # @babel/plugin-transform-block-scoping | ||
{ | ||
"plugins": ["@babel/transform-block-scoping"] | ||
"plugins": ["@babel/plugin-transform-block-scoping"] | ||
} | ||
@@ -53,3 +53,3 @@ ``` | ||
"plugins": [ | ||
["@babel/transform-block-scoping", { | ||
["@babel/plugin-transform-block-scoping", { | ||
"throwIfClosureRequired": true | ||
@@ -64,3 +64,3 @@ }] | ||
```sh | ||
babel --plugins @babel/transform-block-scoping script.js | ||
babel --plugins @babel/plugin-transform-block-scoping script.js | ||
``` | ||
@@ -72,3 +72,3 @@ | ||
require("@babel/core").transform("code", { | ||
plugins: ["@babel/transform-block-scoping"] | ||
plugins: ["@babel/plugin-transform-block-scoping"] | ||
}); | ||
@@ -75,0 +75,0 @@ ``` |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
24383
625