From 1e82483152cdf96df08c3fbbe8c2a3ba2d3d9824 Mon Sep 17 00:00:00 2001 From: Irmen de Jong Date: Tue, 22 Oct 2024 21:14:55 +0200 Subject: [PATCH] ast printer correctly prints ifexpression --- compilerAst/src/prog8/ast/AstToSourceTextConverter.kt | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/compilerAst/src/prog8/ast/AstToSourceTextConverter.kt b/compilerAst/src/prog8/ast/AstToSourceTextConverter.kt index 604e49343..c4a7ec2e1 100644 --- a/compilerAst/src/prog8/ast/AstToSourceTextConverter.kt +++ b/compilerAst/src/prog8/ast/AstToSourceTextConverter.kt @@ -53,6 +53,15 @@ class AstToSourceTextConverter(val output: (text: String) -> Unit, val program: outputln("}\n") } + override fun visit(ifExpr: IfExpression) { + output("if ") + ifExpr.condition.accept(this) + output(" ") + ifExpr.truevalue.accept(this) + output(" else ") + ifExpr.falsevalue.accept(this) + } + override fun visit(continueStmt: Continue) { output("continue") }