@@ -53,44 +53,53 @@ fun f() =
5353//│ this.pc = pc;
5454//│ }
5555//│ resume(value$) {
56- //│ if (this.pc === 1) {
57- //│ scrut = value$;
58- //│ } else if (this.pc === 2) {
59- //│ tmp = value$;
60- //│ } else if (this.pc === 3) {
61- //│ tmp1 = value$;
56+ //│ switch (this.pc) {
57+ //│ case 1:
58+ //│ scrut = value$;
59+ //│ break;
60+ //│ case 2:
61+ //│ tmp = value$;
62+ //│ break;
63+ //│ case 3:
64+ //│ tmp1 = value$;
65+ //│ break;
6266//│ }
6367//│ contLoop: while (true) {
64- //│ if (this.pc === 4) {
65- //│ return j / i
66- //│ } else if (this.pc === 1) {
67- //│ if (scrut === true) {
68- //│ tmp = Predef.raiseUnhandledEffect();
69- //│ if (tmp instanceof runtime.EffectSig.class) {
70- //│ return this.doUnwind(tmp, 2)
68+ //│ switch (this.pc) {
69+ //│ case 4:
70+ //│ return j / i;
71+ //│ break;
72+ //│ case 1:
73+ //│ if (scrut === true) {
74+ //│ tmp = Predef.raiseUnhandledEffect();
75+ //│ if (tmp instanceof runtime.EffectSig.class) {
76+ //│ return this.doUnwind(tmp, 2)
77+ //│ }
78+ //│ this.pc = 2;
79+ //│ continue contLoop
80+ //│ } else {
81+ //│ tmp1 = runtime.Unit;
82+ //│ this.pc = 4;
83+ //│ continue contLoop
7184//│ }
72- //│ this.pc = 2;
73- //│ continue contLoop
74- //│ } else {
75- //│ tmp1 = runtime.Unit;
85+ //│ /* unreachable */
86+ //│ break;
87+ //│ case 5:
88+ //│ tmp1 = Predef.print(tmp);
89+ //│ if (tmp1 instanceof runtime.EffectSig.class) {
90+ //│ return this.doUnwind(tmp1, 3)
91+ //│ }
92+ //│ this.pc = 3;
93+ //│ continue contLoop;
94+ //│ break;
95+ //│ case 2:
96+ //│ this.pc = 5;
97+ //│ continue contLoop;
98+ //│ break;
99+ //│ case 3:
76100//│ this.pc = 4;
77- //│ continue contLoop
78- //│ }
79- //│ this.pc = 4;
80- //│ continue contLoop
81- //│ } else if (this.pc === 5) {
82- //│ tmp1 = Predef.print(tmp);
83- //│ if (tmp1 instanceof runtime.EffectSig.class) {
84- //│ return this.doUnwind(tmp1, 3)
85- //│ }
86- //│ this.pc = 3;
87- //│ continue contLoop
88- //│ } else if (this.pc === 2) {
89- //│ this.pc = 5;
90- //│ continue contLoop
91- //│ } else if (this.pc === 3) {
92- //│ this.pc = 4;
93- //│ continue contLoop
101+ //│ continue contLoop;
102+ //│ break;
94103//│ }
95104//│ break;
96105//│ }
@@ -99,12 +108,16 @@ fun f() =
99108//│ return getLocals3();
100109//│ }
101110//│ get getLoc() {
102- //│ if (this.pc === 1) {
103- //│ return "Debugging.mls:16:6"
104- //│ } else if (this.pc === 2) {
105- //│ return "Debugging.mls:17:14"
106- //│ } else if (this.pc === 3) {
107- //│ return "Debugging.mls:17:5"
111+ //│ switch (this.pc) {
112+ //│ case 1:
113+ //│ return "Debugging.mls:16:6";
114+ //│ break;
115+ //│ case 2:
116+ //│ return "Debugging.mls:17:14";
117+ //│ break;
118+ //│ case 3:
119+ //│ return "Debugging.mls:17:5";
120+ //│ break;
108121//│ }
109122//│ }
110123//│ toString() { return runtime.render(this); }
@@ -148,8 +161,8 @@ lambda_test(() =>
148161 raiseUnhandledEffect()
149162 100)
150163//│ ═══[RUNTIME ERROR] Error: Unhandled effect FatalEffect
151- //│ at lambda (Debugging.mls:148 :3)
152- //│ at lambda_test (Debugging.mls:145 :3)
164+ //│ at lambda (Debugging.mls:161 :3)
165+ //│ at lambda_test (Debugging.mls:158 :3)
153166
154167
155168import "../../mlscript-compile/Runtime.mls"
@@ -228,9 +241,9 @@ fun f() =
228241f()
229242//│ > [FnLocalsInfo("‹top level›", [LocalVarInfo("i", 100)]), FnLocalsInfo("f", [LocalVarInfo("j", 200)])]
230243//│ > Stack Trace:
231- //│ > at f (Debugging.mls:221 :3) with locals: j=200
244+ //│ > at f (Debugging.mls:234 :3) with locals: j=200
232245//│ > Stack Trace:
233- //│ > at f (Debugging.mls:223 :3)
246+ //│ > at f (Debugging.mls:236 :3)
234247//│ > Stack Trace:
235- //│ > at f (Debugging.mls:224 :3) with locals: j=300
248+ //│ > at f (Debugging.mls:237 :3) with locals: j=300
236249//│ > [FnLocalsInfo("‹top level›", [LocalVarInfo("i", 100)]), FnLocalsInfo("f", [LocalVarInfo("j", 300)])]
0 commit comments