diff options
author | Alon Zakai <alonzakai@gmail.com> | 2014-06-03 21:11:54 -0700 |
---|---|---|
committer | Alon Zakai <alonzakai@gmail.com> | 2014-06-03 21:11:54 -0700 |
commit | c9e6b850aadeeea679a9f03be69e3a4f70b172f4 (patch) | |
tree | 00fb7b400d51ef1fa96c4cf1476620724df9dc76 | |
parent | 0968a87becbea2a9fdc8b146b3b6bfae16d5767c (diff) | |
parent | 22179ab0701edd4cee78bb7f2d7576508c96f96e (diff) |
Merge pull request #2401 from rfk/rfk/fix-registerizeHarder-unlabelled-continue
Fix registerizeHarder handling unlabelled continue
-rw-r--r-- | tools/js-optimizer.js | 8 |
1 files changed, 7 insertions, 1 deletions
diff --git a/tools/js-optimizer.js b/tools/js-optimizer.js index 989a7932..03d7fe7f 100644 --- a/tools/js-optimizer.js +++ b/tools/js-optimizer.js @@ -2087,12 +2087,18 @@ function registerizeHarder(ast) { function pushActiveLabels(onContinue, onBreak) { // Push the target junctions for continuing/breaking a loop. // This should be called before traversing into a loop. - var newLabels = copy(activeLabels[activeLabels.length-1]); + var prevLabels = activeLabels[activeLabels.length-1]; + var newLabels = copy(prevLabels); newLabels[null] = [onContinue, onBreak]; if (nextLoopLabel) { newLabels[nextLoopLabel] = [onContinue, onBreak]; nextLoopLabel = null; } + // An unlabelled 'continue' should jump to innermost loop, + // ignoring any nested 'switch' statements. + if (onContinue === null && prevLabels[null]) { + newLabels[null][0] = prevLabels[null][0]; + } activeLabels.push(newLabels); } |