only remap break/continue when inside a loop

This commit is contained in:
Sebastian McKenzie
2015-01-25 18:46:20 +11:00
parent 5c71b1a031
commit a3b58edc52

View File

@@ -315,7 +315,7 @@ var loopVisitor = {
return context.skip();
}
if (node && !node.label) {
if (node && !node.label && state.isLoop) {
if (t.isBreakStatement(node)) {
if (t.isSwitchCase(parent)) return;
@@ -352,6 +352,7 @@ LetScoping.prototype.checkLoop = function () {
hasContinue: false,
hasReturn: false,
hasBreak: false,
isLoop: !!this.loopParent
};
traverse(this.block, loopVisitor, this.scope, state);