only remap break/continue when inside a loop
This commit is contained in:
@@ -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);
|
||||
|
||||
Reference in New Issue
Block a user