File tree Expand file tree Collapse file tree 2 files changed +45
-2
lines changed
data/expression2/tests/regressions
lua/entities/gmod_wire_expression2/base Expand file tree Collapse file tree 2 files changed +45
-2
lines changed Original file line number Diff line number Diff line change 1+ ## SHOULD_PASS:EXECUTE
2+ @strict
3+
4+ try {
5+ error("A")
6+ } catch(A:string) {
7+ assert(A == "A")
8+ }
9+
10+ try {
11+ if(1) {
12+ error("B")
13+ }
14+ } catch(B:string) {
15+ assert(B == "B")
16+ }
17+
18+ if(1) {
19+ try {
20+ error("C")
21+ } catch(C:string) {
22+ assert(C == "C")
23+ }
24+
25+ try {
26+ if(1) {
27+ error("D")
28+ }
29+ } catch(D:string) {
30+ assert(D == "D")
31+ }
32+
33+ let Fn = function() { error("F") }
34+
35+ try {
36+ Fn()
37+ } catch(F:string) {
38+ assert(F == "F")
39+ }
40+ }
Original file line number Diff line number Diff line change @@ -621,10 +621,13 @@ local CompileVisitors = {
621621 self .scope .data .ops = self .scope .data .ops + 5
622622
623623 return function (state ) --- @param state RuntimeContext
624+ local scope , scope_id = state .Scope , state .ScopeID
624625 state :PushScope ()
625626 local ok , err = pcall (try_block , state )
626- state :PopScope ()
627- if not ok then
627+ if ok then
628+ state :PopScope ()
629+ else
630+ state .Scope , state .ScopeID = scope , scope_id -- Skip back any scopes that may have been created in try_block
628631 local catchable , msg = E2Lib .unpackException (err )
629632 if catchable then
630633 state :PushScope ()
You can’t perform that action at this time.
0 commit comments