Merge pull request #6046 from jridgewell/pr/6038

Fix invalid block-scoped loop
This commit is contained in:
Henry Zhu
2017-08-03 08:51:25 -04:00
committed by GitHub
4 changed files with 72 additions and 1 deletions

View File

@@ -459,8 +459,8 @@ class BlockScoping {
this.hoistVarDeclarations();
// turn outsideLetReferences into an array
const params = values(outsideRefs);
const args = values(outsideRefs);
const params = args.map(id => t.clone(id));
const isSwitch = this.blockPath.isSwitchStatement();

View File

@@ -0,0 +1,8 @@
for (let path of c) {
path;
() => path;
}
if (true) {
let path = false;
}

View File

@@ -0,0 +1,36 @@
var _loop = function _loop(path) {
path;
(function () {
return path;
});
};
var _iteratorNormalCompletion = true;
var _didIteratorError = false;
var _iteratorError = undefined;
try {
for (var _iterator = c[Symbol.iterator](), _step; !(_iteratorNormalCompletion = (_step = _iterator.next()).done); _iteratorNormalCompletion = true) {
var _path = _step.value;
_loop(_path);
}
} catch (err) {
_didIteratorError = true;
_iteratorError = err;
} finally {
try {
if (!_iteratorNormalCompletion && _iterator.return) {
_iterator.return();
}
} finally {
if (_didIteratorError) {
throw _iteratorError;
}
}
}
if (true) {
var path = false;
}

View File

@@ -0,0 +1,27 @@
{
"plugins": [
"check-es2015-constants",
"transform-es2015-arrow-functions",
"transform-es2015-block-scoped-functions",
"transform-es2015-block-scoping",
"transform-es2015-classes",
"transform-es2015-computed-properties",
"transform-es2015-destructuring",
"transform-es2015-duplicate-keys",
"transform-es2015-for-of",
"transform-es2015-function-name",
"transform-es2015-literals",
"transform-es2015-object-super",
"transform-es2015-parameters",
"transform-es2015-shorthand-properties",
"transform-es2015-spread",
"transform-es2015-sticky-regex",
"transform-es2015-template-literals",
"transform-es2015-typeof-symbol",
"transform-es2015-unicode-regex",
"transform-regenerator",
"transform-exponentiation-operator",
"transform-async-to-generator",
"syntax-trailing-function-commas"
]
}