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