1
0
mirror of https://github.com/KarolS/millfork.git synced 2024-12-23 08:29:35 +00:00

Fix text literals as expressions

This commit is contained in:
Karol Stasiak 2019-07-19 15:46:38 +02:00
parent 12d32594d1
commit 07a29643a8
2 changed files with 2 additions and 1 deletions

View File

@ -111,7 +111,7 @@ abstract class AbstractStatementPreprocessor(protected val ctx: CompilationConte
stmt match {
case Assignment(ve@VariableExpression(v), arg) if trackableVars(v) =>
cv = search(arg, cv)
Assignment(ve, optimizeExpr(arg, cv)).pos(pos) -> (env.eval(arg, currentVarValues) match {
Assignment(ve, optimizeExpr(arg, cv)).pos(pos) -> (env.eval(optimizeExpr(arg, Map()), currentVarValues) match {
case Some(c) => cv + (v -> c)
case None => cv - v
})

View File

@ -591,6 +591,7 @@ class Environment(val parent: Option[Environment], val prefix: String, val cpuFa
private def evalImpl(e: Expression, vv: Option[Map[String, Constant]]): Option[Constant] = {
e match {
case LiteralExpression(value, size) => Some(NumericConstant(value, size))
case _:TextLiteralExpression => ???
case ConstantArrayElementExpression(c) => Some(c)
case GeneratedConstantExpression(c, t) => Some(c)
case VariableExpression(name) =>