Skip to content

Commit 3913bd5

Browse files
committed
Test cases added for #5532
Added test cases checking that the bytecode generator will not crash when emitting an inverted nested for loop with the outer loop lacking a conditional statement.
1 parent 1335ae4 commit 3913bd5

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed

test/loop/loopinversion.js

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -70,5 +70,10 @@ function g5()
7070
};
7171
g5();
7272

73+
// Tests that loop inversion does not crash when the outer loop does not have
74+
// a condition. In order to not stay in an infinite loop, these functions return
75+
// immediately. The bytecode will still be generated.
76+
function g6(p){if(!p) return; var a = 0; for (var h = 0;; ++h){ for (var r = 0; r < 1; ++r){ a = r; }}};g4a(0);
77+
function g6a(p){"use strict"; if(!p) return; var a = 0; for (var h = 0;; ++h){ for (var r = 0; r < 1; ++r){ a = r; }}};g4a(0);
7378

7479
WScript.Echo("pass");

0 commit comments

Comments
 (0)