Skip to content

Commit 25f78ea

Browse files
committed
deduplicate printSeparated local defs
1 parent 34c7058 commit 25f78ea

File tree

1 file changed

+11
-20
lines changed

1 file changed

+11
-20
lines changed

compiler/src/scala/quoted/runtime/impl/printers/SourceCode.scala

+11-20
Original file line numberDiff line numberDiff line change
@@ -804,6 +804,15 @@ object SourceCode {
804804
}
805805
}
806806

807+
private def printSeparatedParamDefs(list: List[ValDef])(using elideThis: Option[Symbol]): Unit = list match {
808+
case Nil =>
809+
case x :: Nil => printParamDef(x)
810+
case x :: xs =>
811+
printParamDef(x)
812+
this += ", "
813+
printSeparatedParamDefs(xs)
814+
}
815+
807816
private def printMethdArgsDefs(args: List[ValDef])(using elideThis: Option[Symbol]): Unit = {
808817
val argFlags = args match {
809818
case Nil => Flags.EmptyFlags
@@ -813,16 +822,7 @@ object SourceCode {
813822
if (argFlags.is(Flags.Implicit) && !argFlags.is(Flags.Given)) this += "implicit "
814823
if (argFlags.is(Flags.Given)) this += "using "
815824

816-
def printSeparated(list: List[ValDef]): Unit = list match {
817-
case Nil =>
818-
case x :: Nil => printParamDef(x)
819-
case x :: xs =>
820-
printParamDef(x)
821-
this += ", "
822-
printSeparated(xs)
823-
}
824-
825-
printSeparated(args)
825+
printSeparatedParamDefs(args)
826826
}
827827
}
828828

@@ -834,16 +834,7 @@ object SourceCode {
834834
inParens {
835835
if (argFlags.is(Flags.Implicit) && !argFlags.is(Flags.Given)) this += "implicit "
836836

837-
def printSeparated(list: List[ValDef]): Unit = list match {
838-
case Nil =>
839-
case x :: Nil => printParamDef(x)
840-
case x :: xs =>
841-
printParamDef(x)
842-
this += ", "
843-
printSeparated(xs)
844-
}
845-
846-
printSeparated(args)
837+
printSeparatedParamDefs(args)
847838
}
848839
}
849840

0 commit comments

Comments
 (0)