on master help sign in
javascript: compile single branch switch to seq
4d3fdf4raichoo
src/IRTS/CodegenJavaScript.hs+3
@@ -294,6 +294,9 @@ compileJS' indent (JSCond branches) =
294 ++ replicate (indent + 2) ' ' ++ compileJS' (indent + 2) e
294 ++ replicate (indent + 2) ' ' ++ compileJS' (indent + 2) e
295 ++ ";\n" ++ replicate indent ' ' ++ "}"
295 ++ ";\n" ++ replicate indent ' ' ++ "}"
296
296
297+compileJS' indent (JSSwitch val [(_,seq)] Nothing) =
298+ compileJS' indent seq
299+
297compileJS' indent (JSSwitch val branches def) =
300compileJS' indent (JSSwitch val branches def) =
298 "switch(" ++ compileJS' indent val ++ "){\n"
301 "switch(" ++ compileJS' indent val ++ "){\n"
299 ++ concatMap mkBranch branches
302 ++ concatMap mkBranch branches