@@ -92,8 +92,13 @@ object Show extends Phase[CoreTransformed, CoreTransformed] {
9292 case Let (id, annotatedTpe, binding, body) =>
9393 Let (id, annotatedTpe, transform(binding), transform(body))
9494 case Return (expr) => Return (transform(expr))
95- // TODO: We might need to do the same thing as in PureApp if we want to allow show(something) instead of something.show
96- case ImpureApp (id, callee, targs, vargs, bargs, body) => ImpureApp (id, callee, targs, vargs, bargs, body)
95+ case ImpureApp (id, BlockVar (bid, annotatedTpe, annotatedCapt), targs, vargs, bargs, body) if bid.name.name == " myshow" =>
96+ if (targs.length != 1 ) sys error " expected targs to only have one argument"
97+ ctx.getShowBlockVar(targs(0 )) match {
98+ case BlockVar (bid, annotatedTpe, annotatedCapt) =>
99+ Stmt .Val (id, TString , Stmt .App (BlockVar (bid, annotatedTpe, annotatedCapt), List .empty, vargs map transform, bargs map transform), transform(body))
100+ }
101+ case ImpureApp (id, callee, targs, vargs, bargs, body) => ImpureApp (id, callee, targs, vargs, bargs, transform(body))
97102 case o => println(o); ???
98103 }
99104
0 commit comments