From c0dd438df5c8f882e23d93f30836083b7542b6df Mon Sep 17 00:00:00 2001 From: Juliano Alves Date: Sat, 29 Jul 2023 15:02:36 +0200 Subject: [PATCH] using expandBatchActionNew and removes old expandBatchAction --- .../io/getquill/context/ActionMacro.scala | 31 +++---------------- 1 file changed, 4 insertions(+), 27 deletions(-) diff --git a/quill-core/src/main/scala/io/getquill/context/ActionMacro.scala b/quill-core/src/main/scala/io/getquill/context/ActionMacro.scala index 8085933581..86ef7c98c1 100644 --- a/quill-core/src/main/scala/io/getquill/context/ActionMacro.scala +++ b/quill-core/src/main/scala/io/getquill/context/ActionMacro.scala @@ -37,12 +37,13 @@ class ActionMacro(val c: MacroContext) extends ContextMacro with ReifyLiftings { translateBatchQueryPrettyPrint(quoted, q"false") def translateBatchQueryPrettyPrint(quoted: Tree, prettyPrint: Tree): Tree = - expandBatchAction(quoted) { case (batch, param, expanded) => - q""" + expandBatchActionNew(quoted, false) { + case (batch, param, expanded, injectableLiftList, idiomNamingOriginalAstVars, idiomContext, canDoBatch) => + q""" ..${EnableReflectiveCalls(c)} ${c.prefix}.translateBatchQuery( $batch.map { $param => - val (idiomContext, expanded) = $expanded + val expanded = $expanded (expanded.string, expanded.prepare) }.groupBy(_._1).map { case (string, items) => @@ -333,30 +334,6 @@ class ActionMacro(val c: MacroContext) extends ContextMacro with ReifyLiftings { }) """ - def expandBatchAction(quoted: Tree)(call: (Tree, Tree, Tree) => Tree): Tree = - BetaReduction(extractAst(quoted)) match { - case totalAst @ Foreach(lift: Lift, alias, body) => - val batch = lift.value.asInstanceOf[Tree] - val batchItemType = batch.tpe.typeArgs.head - c.typecheck(q"(value: $batchItemType) => value") match { - case q"($param) => $value" => - val nestedLift = - lift match { - case ScalarQueryLift(name, batch: Tree, encoder: Tree, quat) => - ScalarValueLift("value", External.Source.UnparsedProperty("value"), value, encoder, quat) - case CaseClassQueryLift(name, batch: Tree, quat) => - CaseClassValueLift("value", "value", value, quat) - } - val (ast, _) = reifyLiftings(BetaReduction(body, alias -> nestedLift)) - val expanded = expand(ast, Quat.Unknown) - c.untypecheck { - call(batch, param, expanded) - } - } - case other => - c.fail(s"Batch actions must be static quotations. Found: '$other'") - } - def prepareAction(quoted: Tree): Tree = c.untypecheck { q"""