remove loop check when aliasing breaks, continues etc - fixes #1051
This commit is contained in:
parent
d919d7837c
commit
660d764390
@ -527,10 +527,6 @@ class BlockScoping {
|
||||
}
|
||||
|
||||
if (has.hasBreakContinue) {
|
||||
if (!loop) {
|
||||
throw new Error("Aren't in a loop and we're trying to reassign breaks and continues, something is going wrong here.");
|
||||
}
|
||||
|
||||
for (var key in has.map) {
|
||||
cases.push(t.switchCase(t.literal(key), [has.map[key]]));
|
||||
}
|
||||
|
||||
14
test/fixtures/transformation/es6-block-scoping/issue-1051/actual.js
vendored
Normal file
14
test/fixtures/transformation/es6-block-scoping/issue-1051/actual.js
vendored
Normal file
@ -0,0 +1,14 @@
|
||||
foo.func1 = function() {
|
||||
if (cond1) {
|
||||
for (;;) {
|
||||
if (cond2) {
|
||||
function func2() {}
|
||||
function func3() {}
|
||||
func4(function() {
|
||||
func2();
|
||||
});
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
};
|
||||
22
test/fixtures/transformation/es6-block-scoping/issue-1051/expected.js
vendored
Normal file
22
test/fixtures/transformation/es6-block-scoping/issue-1051/expected.js
vendored
Normal file
@ -0,0 +1,22 @@
|
||||
"use strict";
|
||||
|
||||
foo.func1 = function () {
|
||||
if (cond1) {
|
||||
for (;;) {
|
||||
if (cond2) {
|
||||
var _ret = (function () {
|
||||
var func2 = function () {};
|
||||
|
||||
var func3 = function () {};
|
||||
|
||||
func4(function () {
|
||||
func2();
|
||||
});
|
||||
return "break";
|
||||
})();
|
||||
|
||||
if (_ret === "break") break;
|
||||
}
|
||||
}
|
||||
}
|
||||
};
|
||||
Loading…
x
Reference in New Issue
Block a user