add no loopParent warning to block scoping transformer

This commit is contained in:
Sebastian McKenzie
2015-01-24 16:31:52 +11:00
parent 8a13c12738
commit afa0a31b91

View File

@@ -454,6 +454,11 @@ LetScoping.prototype.buildHas = function (ret, call) {
}
if (has.hasBreak || has.hasContinue) {
if (!loopParent) {
throw new Error("Has no loop parent but we're trying to reassign breaks " +
"and continues, something is going wrong here.");
}
// ensure that the parent has a label as we're building a switch and we
// need to be able to access it
var label = loopParent.label = loopParent.label || this.scope.generateUidIdentifier("loop");