@@ -158,7 +158,7 @@ object SourceCode {
158
158
for paramClause <- paramss do
159
159
paramClause match
160
160
case TermParamClause (params) =>
161
- printArgsDefs (params)
161
+ printMethdArgsDefs (params)
162
162
case TypeParamClause (params) =>
163
163
printTargsDefs(stats.collect { case targ : TypeDef => targ }.filter(_.symbol.isTypeParam).zip(params))
164
164
}
@@ -313,7 +313,7 @@ object SourceCode {
313
313
this += highlightKeyword(" def " ) += highlightValDef(name1)
314
314
for clause <- paramss do
315
315
clause match
316
- case TermParamClause (params) => printArgsDefs (params)
316
+ case TermParamClause (params) => printMethdArgsDefs (params)
317
317
case TypeParamClause (params) => printTargsDefs(params.zip(params))
318
318
if (! isConstructor) {
319
319
this += " : "
@@ -460,7 +460,7 @@ object SourceCode {
460
460
461
461
case tree @ Lambda (params, body) => // must come before `Block`
462
462
inParens {
463
- printArgsDefs (params, isLambda = true )
463
+ printLambdaArgsDefs (params)
464
464
this += (if tree.tpe.isContextFunctionType then " ?=> " else " => " )
465
465
printTree(body)
466
466
}
@@ -804,14 +804,35 @@ object SourceCode {
804
804
}
805
805
}
806
806
807
- private def printArgsDefs (args : List [ValDef ], isLambda : Boolean = false )(using elideThis : Option [Symbol ]): Unit = {
807
+ private def printMethdArgsDefs (args : List [ValDef ])(using elideThis : Option [Symbol ]): Unit = {
808
+ val argFlags = args match {
809
+ case Nil => Flags .EmptyFlags
810
+ case arg :: _ => arg.symbol.flags
811
+ }
812
+ inParens {
813
+ if (argFlags.is(Flags .Implicit ) && ! argFlags.is(Flags .Given )) this += " implicit "
814
+ if (argFlags.is(Flags .Given )) this += " using "
815
+
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)
826
+ }
827
+ }
828
+
829
+ private def printLambdaArgsDefs (args : List [ValDef ])(using elideThis : Option [Symbol ]): Unit = {
808
830
val argFlags = args match {
809
831
case Nil => Flags .EmptyFlags
810
832
case arg :: _ => arg.symbol.flags
811
833
}
812
834
inParens {
813
835
if (argFlags.is(Flags .Implicit ) && ! argFlags.is(Flags .Given )) this += " implicit "
814
- if (argFlags.is(Flags .Given ) && ! isLambda) this += " using "
815
836
816
837
def printSeparated (list : List [ValDef ]): Unit = list match {
817
838
case Nil =>
0 commit comments