Skip to content

Commit ea3855a

Browse files
author
Guannan Wei
committed
some clean up
1 parent d13e106 commit ea3855a

File tree

2 files changed

+4
-18
lines changed

2 files changed

+4
-18
lines changed

src/main/scala/wasm/MiniWasm.scala

Lines changed: 4 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -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

src/main/scala/wasm/Parser.scala

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -21,8 +21,6 @@ class GSWasmVisitor extends WatParserBaseVisitor[WIR] {
2121

2222
/* Some helper functions */
2323

24-
// TODO: see TODO in 2o1u-no-label.wat
25-
2624
val fnMap: HashMap[String, Int] = HashMap()
2725

2826
// Note: we construct a mapping from indices to function-like definitions, which helps
@@ -392,12 +390,6 @@ class GSWasmVisitor extends WatParserBaseVisitor[WIR] {
392390
}
393391
}
394392

395-
// override def visitCallInstrInstr(ctx: CallInstrInstrContext): WIR = {
396-
// println(s"unimplemented parser for: ${ctx.getText}")
397-
// ???
398-
// }
399-
400-
401393
override def visitBlockType(ctx: BlockTypeContext): BlockType = {
402394
if (ctx.typeUse != null) {
403395
// TODO: explicit type use

0 commit comments

Comments
 (0)