1
0
mirror of https://github.com/KarolS/millfork.git synced 2025-01-12 19:29:51 +00:00

Fix optimized struct assignments

This commit is contained in:
Karol Stasiak 2019-07-31 22:30:33 +02:00
parent fe25978d14
commit a3a168b90b

View File

@ -191,6 +191,10 @@ object MosStatementCompiler extends AbstractStatementCompiler[AssemblyLine] {
case Assignment(dest, source) =>
MosExpressionCompiler.compileAssignment(ctx, source, dest) -> Nil
case ExpressionStatement(e@FunctionCallExpression(name, params)) =>
env.maybeGet[Type](name) match {
case Some(_) =>
params.flatMap(p => MosExpressionCompiler.compile(ctx, p, None, NoBranching))-> Nil
case None =>
env.lookupFunction(name, params.map(p => MosExpressionCompiler.getExpressionType(ctx, p) -> p)) match {
case Some(i: MacroFunction) =>
val (paramPreparation, inlinedStatements) = MosMacroExpander.inlineFunction(ctx, i, params, e.position)
@ -198,6 +202,7 @@ object MosStatementCompiler extends AbstractStatementCompiler[AssemblyLine] {
case _ =>
MosExpressionCompiler.compile(ctx, e, None, NoBranching) -> Nil
}
}
case ExpressionStatement(e) =>
e match {
case VariableExpression(_) | LiteralExpression(_, _) | _:GeneratedConstantExpression =>