array literal const check added

This commit is contained in:
Irmen de Jong 2020-09-18 21:30:59 +02:00
parent f1ee3b4e60
commit 9b66a597bb
3 changed files with 8 additions and 2 deletions

View File

@ -1 +1 @@
4.2
4.3-SNAPSHOT

View File

@ -742,6 +742,11 @@ internal class AstChecker(private val program: Program,
checkValueTypeAndRangeArray(array.type.typeOrElse(DataType.STRUCT), null, arrayspec, array)
}
if(!array.value.all { it.constValue(program)!=null }) {
// TODO for now, array literals have to consist of all compile time constant values...
errors.err("array literal doesn't consist of only compile time constant values", array.position)
}
super.visit(array)
}
@ -1098,7 +1103,7 @@ internal class AstChecker(private val program: Program,
}
if(value.type.isUnknown)
return err("attempt to check values of array with as yet unknown datatype")
return false
when (targetDt) {
DataType.STR -> return err("string value expected")

View File

@ -5,6 +5,7 @@ TODO
- get rid of all other TODO's in the code ;-)
- line-circle-gfx examples are now a few hundred bytes larger than before. Why is that, can it be fixed?
- compiler errors and warnings in standard format so the IDE shows them as clickable links; ./test.asm:2578:3: blablabla
- make it possible for array literals to not only contain compile time constants
- further optimize assignment codegeneration
- auto select correct library to import based on target, instead of having c64- and cx16- prefix variants
- implement @stack for asmsub parameters