From 0f4a197e347d1387e1dacf2adeee13d653dd9399 Mon Sep 17 00:00:00 2001 From: Irmen de Jong Date: Thu, 14 Apr 2022 00:49:06 +0200 Subject: [PATCH] improve ast check on pipe expressions --- .../src/prog8/compiler/astprocessing/AstChecker.kt | 10 ++++++++-- docs/source/todo.rst | 1 - examples/test.p8 | 1 - 3 files changed, 8 insertions(+), 4 deletions(-) diff --git a/compiler/src/prog8/compiler/astprocessing/AstChecker.kt b/compiler/src/prog8/compiler/astprocessing/AstChecker.kt index 84a7fd79b..47e6891f2 100644 --- a/compiler/src/prog8/compiler/astprocessing/AstChecker.kt +++ b/compiler/src/prog8/compiler/astprocessing/AstChecker.kt @@ -1103,9 +1103,15 @@ internal class AstChecker(private val program: Program, } } - override fun visit(pipe: PipeExpression) = process(pipe) + override fun visit(pipe: PipeExpression) { + process(pipe) + super.visit(pipe) + } - override fun visit(pipe: Pipe) = process(pipe) + override fun visit(pipe: Pipe) { + process(pipe) + super.visit(pipe) + } private fun process(pipe: IPipe) { if(pipe.source in pipe.segments) diff --git a/docs/source/todo.rst b/docs/source/todo.rst index c3d3433e2..075883fe5 100644 --- a/docs/source/todo.rst +++ b/docs/source/todo.rst @@ -3,7 +3,6 @@ TODO For next release ^^^^^^^^^^^^^^^^ -- "999 as ubyte" won't be const folded away and gives compiler crash - pipe operator: allow non-unary function calls in the pipe that specify the other argument(s) in the calls. - createAssemblyAndAssemble(): make it possible to actually get rid of the VarDecl nodes by fixing the rest of the code mentioned there. - allow "xxx" * constexpr (where constexpr is not a number literal), now gives expression error not same type diff --git a/examples/test.p8 b/examples/test.p8 index 6270364de..83efc58be 100644 --- a/examples/test.p8 +++ b/examples/test.p8 @@ -6,7 +6,6 @@ main { sub start() { - uword qq = 999 as ubyte |> abs() |> abs() txt.print_uw(qq) txt.nl()