@@ -186,7 +186,7 @@ object Evaluator {
186186
187187 def getFuncType (module : ModuleInstance , ty : BlockType ): FuncType = {
188188 ty match {
189- case VarBlockType (_, None ) => ??? // TODO: fill this branch until we handle type index correctly
189+ case VarBlockType (_, None ) => ??? // TODO: fill this branch until we handle type index correctly
190190 case VarBlockType (_, Some (tipe)) => tipe
191191 case ValBlockType (Some (tipe)) => FuncType (List (), List (), List (tipe))
192192 case ValBlockType (None ) => FuncType (List (), List (), List ())
@@ -299,12 +299,8 @@ object Evaluator {
299299 val (inputs, restStack) = stack.splitAt(funcTy.inps.size)
300300 val restK : Cont [Ans ] = (retStack) =>
301301 eval(rest, retStack.take(funcTy.out.size) ++ restStack, frame, kont, trail, ret)
302-
303- def loop (retStack : List [Value ]): Ans = {
304- val k : Cont [Ans ] = (retStack) => loop(retStack) // k is just same as loop
305- eval(inner, retStack.take(funcTy.inps.size), frame, restK, k :: trail, ret + 1 )
306- }
307-
302+ def loop (retStack : List [Value ]): Ans =
303+ eval(inner, retStack.take(funcTy.inps.size), frame, restK, loop _ :: trail, ret + 1 )
308304 loop(inputs)
309305 case If (ty, thn, els) =>
310306 val funcTy = getFuncType(frame.module, ty)
@@ -378,9 +374,7 @@ object Evaluator {
378374 })
379375 }
380376
381- if (instrs.isEmpty) {
382- println(" Warning: nothing is executed" )
383- }
377+ if (instrs.isEmpty) println(" Warning: nothing is executed" )
384378
385379 val types = List ()
386380 val funcs = module.definitions
0 commit comments