mirror of
https://github.com/KarolS/millfork.git
synced 2025-01-10 05:29:49 +00:00
Support local labels in macros for all instructions
This commit is contained in:
parent
03a57138f0
commit
2905e99521
11
src/main/scala/millfork/env/Environment.scala
vendored
11
src/main/scala/millfork/env/Environment.scala
vendored
@ -937,8 +937,15 @@ class Environment(val parent: Option[Environment], val prefix: String, val cpuFa
|
||||
case ConstantArrayElementExpression(c) => Some(c)
|
||||
case VariableExpression(name) =>
|
||||
val result = maybeGet[ConstantThing](name).map(_.value).orElse(maybeGet[ThingInMemory](name).map(_.toAddress))
|
||||
if (!silent && result.isEmpty) log.warn(s"$name is not known", e.position)
|
||||
result
|
||||
result match {
|
||||
case Some(x) => result
|
||||
case None =>
|
||||
if (name.startsWith(".")) Some(Label(name).toAddress)
|
||||
else {
|
||||
if (!silent) log.warn(s"$name is not known", e.position)
|
||||
None
|
||||
}
|
||||
}
|
||||
case IndexedExpression(name, index) => (evalForAsm(VariableExpression(name)), evalForAsm(index)) match {
|
||||
case (Some(a), Some(b)) => Some(CompoundConstant(MathOperator.Plus, a, b).quickSimplify)
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user