From 9f54a4d111eed5f1bd12513d7d5c27d6ce6a40da Mon Sep 17 00:00:00 2001 From: Karol Stasiak Date: Thu, 22 Feb 2018 13:36:19 +0100 Subject: [PATCH] Macros should also accept indexed expressions as actual params --- src/main/scala/millfork/compiler/MacroExpander.scala | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/main/scala/millfork/compiler/MacroExpander.scala b/src/main/scala/millfork/compiler/MacroExpander.scala index 24444937..cafcf994 100644 --- a/src/main/scala/millfork/compiler/MacroExpander.scala +++ b/src/main/scala/millfork/compiler/MacroExpander.scala @@ -88,6 +88,8 @@ object MacroExpander { params.zip(normalParams).foreach{ case (v@VariableExpression(_), MemoryVariable(paramName, paramType, _)) => actualCode = actualCode.map(stmt => replaceVariable(stmt, paramName.stripPrefix(i.environment.prefix), v).asInstanceOf[ExecutableStatement]) + case (v@IndexedExpression(_, _), MemoryVariable(paramName, paramType, _)) => + actualCode = actualCode.map(stmt => replaceVariable(stmt, paramName.stripPrefix(i.environment.prefix), v).asInstanceOf[ExecutableStatement]) case _ => ErrorReporting.error(s"Parameters to macro functions have to be variables", position) }