This commit is contained in:
Irmen de Jong 2023-11-17 00:37:12 +01:00
parent ff8de8e42d
commit 161c02ced3
5 changed files with 8 additions and 8 deletions

View File

@ -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)

View File

@ -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?

View File

@ -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") {

View File

@ -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 ....
...

View File

@ -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()
}
}