correction, we don't allow address-of as a value for memory mapped vars, improved the error message instead

This commit is contained in:
Irmen de Jong 2020-09-19 15:54:42 +02:00
parent bc89306dc1
commit f2b069c562

View File

@ -589,10 +589,8 @@ internal class AstChecker(private val program: Program,
if (value.type !in IntegerDatatypes || value.number.toInt() < 0 || value.number.toInt() > 65535) {
err("memory address must be valid integer 0..\$ffff", decl.value?.position)
}
} else if(decl.value is AddressOf) {
// we allow this too: the address of another variable
} else {
err("value of memory var decl is invalid type.", decl.value?.position)
err("value of memory mapped variable can only be a number, perhaps you meant to use an address pointer type instead?", decl.value?.position)
}
}
}