1 When compiling a try/catch statement with an exception variable, the catch 2 skip jump incorrectly pointed to the POP instruction popping the exception 3 variable off the stack, leading to a stack position mismatch between 4 compiler and vm, causing local variables to yield wrong values at runtime. 5 6 -- Expect stdout -- 7 1 8 -- End -- 9 10 -- Testcase -- 11 {% 12 function f() { 13 let x; 14 15 try { 16 x = 1; 17 } 18 catch(e) { 19 20 } 21 22 // Before the fix, `x` incorrectly yielded the print function value 23 print(x, "\n"); 24 } 25 26 f() 27 %} 28 -- End -- 29 30 31 When compiling a try/catch statement with local variable declearations 32 within the try block, the catch skip jump incorrectly happened before the 33 local try block variables were popped off the stack, leading to a stack 34 position mismatch between compiler and vm, causing local variables to 35 yield wrong values at runtime. 36 37 -- Expect stdout -- 38 1 39 -- End -- 40 41 -- Testcase -- 42 {% 43 try { 44 let a; 45 } 46 catch {} 47 48 let b = 1; 49 50 print(b, "\n"); 51 %} 52 -- End --
This page was automatically generated by LXR 0.3.1. • OpenWrt