mirror of
https://github.com/KarolS/millfork.git
synced 2025-08-10 01:25:31 +00:00
A variable with fixed address shouldn't have an initial value
This commit is contained in:
@@ -605,6 +605,7 @@ class Environment(val parent: Option[Environment], val prefix: String) {
|
|||||||
} else {
|
} else {
|
||||||
if (stmt.stack && stmt.global) ErrorReporting.error(s"`$name` is static or global and cannot be on stack", position)
|
if (stmt.stack && stmt.global) ErrorReporting.error(s"`$name` is static or global and cannot be on stack", position)
|
||||||
if (stmt.initialValue.isDefined && parent.isDefined) ErrorReporting.error(s"`$name` is local and not a constant and therefore cannot have a value", position)
|
if (stmt.initialValue.isDefined && parent.isDefined) ErrorReporting.error(s"`$name` is local and not a constant and therefore cannot have a value", position)
|
||||||
|
if (stmt.initialValue.isDefined && stmt.address.isDefined) ErrorReporting.warn(s"`$name` has both address and initial value - this may not work as expected!", options, position)
|
||||||
if (stmt.stack) {
|
if (stmt.stack) {
|
||||||
val v = StackVariable(prefix + name, typ, this.baseStackOffset)
|
val v = StackVariable(prefix + name, typ, this.baseStackOffset)
|
||||||
baseStackOffset += typ.size
|
baseStackOffset += typ.size
|
||||||
|
Reference in New Issue
Block a user