blob: 461b14491a56c3642f5caf1aaf7115f6b4d2e8c6 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
|
When compiling a break or continue statement, the compiler emitted pop
instructions for local variables within the scope the break or continue
keyword appeared in, but it must also pop local variables in enclosing
scopes up until the scope of the containing loop or switch body.
-- Expect stdout --
1
2
3
-- End --
-- Testcase --
{%
for (let i = 1; i <= 3; i++) {
while (true) {
let n = i;
print(n, "\n");
{
// The `let n` stack slot is not popped since it is
// outside of break's scope...
break;
}
}
}
%}
-- End --
-- Expect stdout --
1
2
3
2
4
6
3
6
9
-- End --
-- Testcase --
{%
for (let i = 1; i <= 3; i++) {
for (let j = 1; j <= 3; j++) {
let n = i * j;
print(n, "\n");
if (j == 1)
{
// The `let n` stack slot is not popped since it is
// outside of continue's scope...
continue;
}
}
}
%}
-- End --
|