From f9c68d8bd165291a18a46f4f8aaf5b580a2b87bb Mon Sep 17 00:00:00 2001 From: Jules Ivanic Date: Mon, 2 Oct 2023 11:48:43 +0400 Subject: [PATCH] Remove unused code (#2900) --- .../scala/io/getquill/ast/StatelessTransformer.scala | 2 +- .../getquill/norm/capture/DemarcateExternalAliases.scala | 9 ++++----- 2 files changed, 5 insertions(+), 6 deletions(-) diff --git a/quill-engine/src/main/scala/io/getquill/ast/StatelessTransformer.scala b/quill-engine/src/main/scala/io/getquill/ast/StatelessTransformer.scala index fc80c44fbb..0b4ce9ce3a 100644 --- a/quill-engine/src/main/scala/io/getquill/ast/StatelessTransformer.scala +++ b/quill-engine/src/main/scala/io/getquill/ast/StatelessTransformer.scala @@ -2,7 +2,7 @@ package io.getquill.ast trait StatelessTransformer { - def applyIdent(id: Ident) = id + def applyIdent(id: Ident): Ident = id def apply(e: Ast): Ast = e match { diff --git a/quill-engine/src/main/scala/io/getquill/norm/capture/DemarcateExternalAliases.scala b/quill-engine/src/main/scala/io/getquill/norm/capture/DemarcateExternalAliases.scala index 5c96d3b7d9..01b289b2eb 100644 --- a/quill-engine/src/main/scala/io/getquill/norm/capture/DemarcateExternalAliases.scala +++ b/quill-engine/src/main/scala/io/getquill/norm/capture/DemarcateExternalAliases.scala @@ -20,10 +20,10 @@ import io.getquill.ast._ * body. Other places where this needs to be done (e.g. in a Tuple that * `Returning` returns) are done in `ExpandReturning`. */ -private[getquill] case class DemarcateExternalAliases(externalIdent: Ident) extends StatelessTransformer { +private[getquill] final case class DemarcateExternalAliases(externalIdent: Ident) extends StatelessTransformer { - def applyNonOverride(idents: Ident*)(ast: Ast) = - if (idents.forall(_ != externalIdent)) apply(ast) + private def applyNonOverride(idents: Ident*)(ast: Ast): Ast = + if (!idents.contains(externalIdent)) apply(ast) else ast override def apply(ast: Ast): Ast = ast match { @@ -71,7 +71,7 @@ private[getquill] case class DemarcateExternalAliases(externalIdent: Ident) exte object DemarcateExternalAliases { - private def demarcateQueriesInBody(id: Ident, body: Ast) = + private def demarcateQueriesInBody(id: Ident, body: Ast): Ast = Transform(body) { // Apply to the AST defined apply method about, not to the superclass method that takes Query case q: Query => new DemarcateExternalAliases(id).apply(q.asInstanceOf[Ast]) @@ -81,7 +81,6 @@ object DemarcateExternalAliases { case Returning(a, id, body) => Returning(a, id, demarcateQueriesInBody(id, body)) case ReturningGenerated(a, id, body) => - val d = demarcateQueriesInBody(id, body) ReturningGenerated(a, id, demarcateQueriesInBody(id, body)) case other => other