mirror of
https://github.com/irmen/prog8.git
synced 2024-12-01 15:52:54 +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 {
|
sourceValue: Expression) : Boolean {
|
||||||
val position = sourceValue.position
|
val position = sourceValue.position
|
||||||
|
|
||||||
if(sourceValue is ArrayLiteral || targetDatatype in ArrayDatatypes) {
|
if (targetDatatype in ArrayDatatypes) {
|
||||||
errors.err("cannot assign arrays directly. Maybe use sys.memcopy(src, tgt, sizeof(tgt)) instead.", target.position)
|
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
|
return false
|
||||||
}
|
}
|
||||||
|
|
||||||
if(sourceValue is RangeExpression) {
|
if(sourceValue is RangeExpression) {
|
||||||
errors.err("can't assign a range value to something else", position)
|
errors.err("can't assign a range value to something else", position)
|
||||||
return false
|
return false
|
||||||
}
|
}
|
||||||
|
|
||||||
if(sourceDatatype==DataType.UNDEFINED) {
|
if(sourceDatatype==DataType.UNDEFINED) {
|
||||||
errors.err("assignment right hand side doesn't result in a value", position)
|
errors.err("assignment right hand side doesn't result in a value", position)
|
||||||
return false
|
return false
|
||||||
|
@ -14,7 +14,8 @@ main {
|
|||||||
txt.spc()
|
txt.spc()
|
||||||
}
|
}
|
||||||
txt.nl()
|
txt.nl()
|
||||||
sys.memcopy(words2, words1, sizeof(words1))
|
cx16.r0L = words2
|
||||||
|
sys.memsetw(words1, len(words1), 99)
|
||||||
for cx16.r0 in words1 {
|
for cx16.r0 in words1 {
|
||||||
txt.print_uw(cx16.r0)
|
txt.print_uw(cx16.r0)
|
||||||
txt.spc()
|
txt.spc()
|
||||||
|
Loading…
Reference in New Issue
Block a user