2323import chipmunk .vm .tree .Fiber ;
2424import chipmunk .vm .tree .Node ;
2525
26- import static chipmunk .vm .tree .Conversions .*;
27-
2826public class For implements Node {
2927 public Node pre ;
3028 public Node test ;
@@ -42,22 +40,22 @@ public Object doPre(Fiber ctx) {
4240 try {
4341 pre .execute (ctx );
4442 } catch (Exception e ) {
45- ctx .suspendStateless (e , ( c , s ) -> doTest ( c ) );
43+ ctx .suspendStateless (e , this :: doTest );
4644 }
4745 }
4846 return null ;
4947 }
5048
51- public boolean doTest (Fiber ctx ) {
49+ public Boolean doTest (Fiber ctx ) {
5250 try {
53- return test .executeBoolean (ctx );
51+ return ( Boolean ) test .execute (ctx );
5452 } catch (Exception e ) {
55- ctx .suspendStateless (e , (c , s ) -> doBody (c , toBoolean ( s ) ));
53+ ctx .suspendStateless (e , (c , s ) -> doBody (c , ( Boolean ) s ));
5654 }
5755 return false ; // suspend() will rethrow so this will never be reached
5856 }
5957
60- public Object doBody (Fiber ctx , boolean test ) {
58+ public Object doBody (Fiber ctx , Boolean test ) {
6159 var t = test ;
6260 while (t && !ctx .checkInterrupt ()) {
6361 try {
@@ -66,18 +64,18 @@ public Object doBody(Fiber ctx, boolean test) {
6664 ctx .suspendStateless (e , this ::doPost );
6765 }
6866
69- doPost (ctx , 0 );
67+ doPost (ctx );
7068 t = doTest (ctx );
7169 }
7270 return 0 ;
7371 }
7472
75- public Object doPost (Fiber ctx , Object prior ) {
73+ public Object doPost (Fiber ctx ) {
7674 if (post != null ) {
7775 try {
7876 post .execute (ctx );
7977 } catch (Exception e ) {
80- ctx .suspendStateless (e , ( c , s ) -> doTest ( c ) );
78+ ctx .suspendStateless (e , this :: doTest );
8179 }
8280 }
8381 return null ;
0 commit comments