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:
parent
fe25978d14
commit
a3a168b90b
@ -191,12 +191,17 @@ object MosStatementCompiler extends AbstractStatementCompiler[AssemblyLine] {
|
|||||||
case Assignment(dest, source) =>
|
case Assignment(dest, source) =>
|
||||||
MosExpressionCompiler.compileAssignment(ctx, source, dest) -> Nil
|
MosExpressionCompiler.compileAssignment(ctx, source, dest) -> Nil
|
||||||
case ExpressionStatement(e@FunctionCallExpression(name, params)) =>
|
case ExpressionStatement(e@FunctionCallExpression(name, params)) =>
|
||||||
env.lookupFunction(name, params.map(p => MosExpressionCompiler.getExpressionType(ctx, p) -> p)) match {
|
env.maybeGet[Type](name) match {
|
||||||
case Some(i: MacroFunction) =>
|
case Some(_) =>
|
||||||
val (paramPreparation, inlinedStatements) = MosMacroExpander.inlineFunction(ctx, i, params, e.position)
|
params.flatMap(p => MosExpressionCompiler.compile(ctx, p, None, NoBranching))-> Nil
|
||||||
paramPreparation ++ compile(ctx.withInlinedEnv(i.environment, ctx.nextLabel("en")), inlinedStatements)._1 -> Nil
|
case None =>
|
||||||
case _ =>
|
env.lookupFunction(name, params.map(p => MosExpressionCompiler.getExpressionType(ctx, p) -> p)) match {
|
||||||
MosExpressionCompiler.compile(ctx, e, None, NoBranching) -> Nil
|
case Some(i: MacroFunction) =>
|
||||||
|
val (paramPreparation, inlinedStatements) = MosMacroExpander.inlineFunction(ctx, i, params, e.position)
|
||||||
|
paramPreparation ++ compile(ctx.withInlinedEnv(i.environment, ctx.nextLabel("en")), inlinedStatements)._1 -> Nil
|
||||||
|
case _ =>
|
||||||
|
MosExpressionCompiler.compile(ctx, e, None, NoBranching) -> Nil
|
||||||
|
}
|
||||||
}
|
}
|
||||||
case ExpressionStatement(e) =>
|
case ExpressionStatement(e) =>
|
||||||
e match {
|
e match {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user