From 161c02ced36c3278a872a063305f1c2dd67658c0 Mon Sep 17 00:00:00 2001 From: Irmen de Jong Date: Fri, 17 Nov 2023 00:37:12 +0100 Subject: [PATCH] message --- .../src/prog8/codegen/intermediate/IRCodeGen.kt | 1 - compiler/src/prog8/compiler/astprocessing/AstChecker.kt | 2 +- compiler/test/TestAstChecks.kt | 2 +- docs/source/todo.rst | 3 ++- examples/test.p8 | 8 ++++---- 5 files changed, 8 insertions(+), 8 deletions(-) diff --git a/codeGenIntermediate/src/prog8/codegen/intermediate/IRCodeGen.kt b/codeGenIntermediate/src/prog8/codegen/intermediate/IRCodeGen.kt index 873de6fc5..d1c381f92 100644 --- a/codeGenIntermediate/src/prog8/codegen/intermediate/IRCodeGen.kt +++ b/codeGenIntermediate/src/prog8/codegen/intermediate/IRCodeGen.kt @@ -1019,7 +1019,6 @@ class IRCodeGen( } } - // TODO use this everywhere a PtJump is used private fun branchInstr(goto: PtJump, branchOpcode: Opcode) = if (goto.address != null) IRInstruction(branchOpcode, address = goto.address?.toInt()) else if (goto.generatedLabel != null) diff --git a/compiler/src/prog8/compiler/astprocessing/AstChecker.kt b/compiler/src/prog8/compiler/astprocessing/AstChecker.kt index 096ca53bf..f089be22b 100644 --- a/compiler/src/prog8/compiler/astprocessing/AstChecker.kt +++ b/compiler/src/prog8/compiler/astprocessing/AstChecker.kt @@ -593,7 +593,7 @@ internal class AstChecker(private val program: Program, // CONST can only occur on simple types (byte, word, float) if(decl.type== VarDeclType.CONST) { if (decl.datatype !in NumericDatatypes) - err("const modifier can only be used on numeric types (byte, word, float)") + err("const can only be used on numeric types (byte, word, float)") } // FLOATS enabled? diff --git a/compiler/test/TestAstChecks.kt b/compiler/test/TestAstChecks.kt index 008bce992..69e9c331d 100644 --- a/compiler/test/TestAstChecks.kt +++ b/compiler/test/TestAstChecks.kt @@ -110,7 +110,7 @@ class TestAstChecks: FunSpec({ compileText(C64Target(), true, text, writeAssembly = true, errors=errors) errors.errors.size shouldBe 1 errors.warnings.size shouldBe 0 - errors.errors[0] shouldContain "const modifier can only be used" + errors.errors[0] shouldContain "const can only be used" } test("array indexing is not allowed on a memory mapped variable") { diff --git a/docs/source/todo.rst b/docs/source/todo.rst index f803c99bb..dbfd61680 100644 --- a/docs/source/todo.rst +++ b/docs/source/todo.rst @@ -2,7 +2,8 @@ TODO ==== -- IR: use branchInstr() everywhere a PtGoto is used in IRCodeGen +- fix discord string bug for if key!="." : "ERROR undefined symbol: prog8_interned_strings.string_3" + - [on branch: shortcircuit] investigate McCarthy evaluation again? this may also reduce code size perhaps for things like if a>4 or a<2 .... ... diff --git a/examples/test.p8 b/examples/test.p8 index 6396209b3..80a127da5 100644 --- a/examples/test.p8 +++ b/examples/test.p8 @@ -3,10 +3,10 @@ main { sub start() { - ubyte xx=12 - - if xx==12 - txt.print("gottem") + str name="irmen" + if name=="." { + cx16.r0++ + } txt.nl() } }