Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Remove unused code #2900

Merged
merged 2 commits into from
Oct 2, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

IntelliJ suggestion

private def applyNonOverride(idents: Ident*)(ast: Ast): Ast =
if (!idents.contains(externalIdent)) apply(ast)
else ast

override def apply(ast: Ast): Ast = ast match {
Expand Down Expand Up @@ -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])
Expand All @@ -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)
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Unused code

ReturningGenerated(a, id, demarcateQueriesInBody(id, body))
case other =>
other
Expand Down