mirror of
https://github.com/irmen/prog8.git
synced 2024-11-25 04:31:20 +00:00
err msgs
This commit is contained in:
parent
b6ffb81909
commit
5280e1b449
@ -1813,16 +1813,21 @@ internal class AstChecker(private val program: Program,
|
||||
sourceValue: Expression) : Boolean {
|
||||
val position = sourceValue.position
|
||||
|
||||
if(sourceValue is ArrayLiteral || targetDatatype in ArrayDatatypes) {
|
||||
errors.err("cannot assign arrays directly. Maybe use sys.memcopy(src, tgt, sizeof(tgt)) instead.", target.position)
|
||||
if (targetDatatype in ArrayDatatypes) {
|
||||
if(sourceValue.inferType(program).isArray)
|
||||
errors.err("cannot assign arrays directly. Maybe use sys.memcopy instead.", target.position)
|
||||
else
|
||||
errors.err("cannot assign value to array. Maybe use sys.memset/memsetw instead.", target.position)
|
||||
return false
|
||||
}
|
||||
if (sourceValue is ArrayLiteral) {
|
||||
errors.err("cannot assign array", target.position)
|
||||
return false
|
||||
}
|
||||
|
||||
if(sourceValue is RangeExpression) {
|
||||
errors.err("can't assign a range value to something else", position)
|
||||
return false
|
||||
}
|
||||
|
||||
if(sourceDatatype==DataType.UNDEFINED) {
|
||||
errors.err("assignment right hand side doesn't result in a value", position)
|
||||
return false
|
||||
|
@ -14,7 +14,8 @@ main {
|
||||
txt.spc()
|
||||
}
|
||||
txt.nl()
|
||||
sys.memcopy(words2, words1, sizeof(words1))
|
||||
cx16.r0L = words2
|
||||
sys.memsetw(words1, len(words1), 99)
|
||||
for cx16.r0 in words1 {
|
||||
txt.print_uw(cx16.r0)
|
||||
txt.spc()
|
||||
|
Loading…
Reference in New Issue
Block a user