@@ -152,12 +152,12 @@ object SourceCode {
152152 if (flags.is(Flags .Case )) this += highlightKeyword(" case " )
153153
154154 if (name == " package$" ) {
155- this += highlightKeyword(" package object " ) += highlightTypeDef (cdef.symbol.owner.name.stripSuffix(" $" ))
155+ this += highlightKeyword(" package object " ) += highlightType (cdef.symbol.owner.name.stripSuffix(" $" ))
156156 }
157- else if (flags.is(Flags .Module )) this += highlightKeyword(" object " ) += highlightTypeDef (name.stripSuffix(" $" ))
158- else if (flags.is(Flags .Trait )) this += highlightKeyword(" trait " ) += highlightTypeDef (name)
159- else if (flags.is(Flags .Abstract )) this += highlightKeyword(" abstract class " ) += highlightTypeDef (name)
160- else this += highlightKeyword(" class " ) += highlightTypeDef (name)
157+ else if (flags.is(Flags .Module )) this += highlightKeyword(" object " ) += highlightType (name.stripSuffix(" $" ))
158+ else if (flags.is(Flags .Trait )) this += highlightKeyword(" trait " ) += highlightType (name)
159+ else if (flags.is(Flags .Abstract )) this += highlightKeyword(" abstract class " ) += highlightType (name)
160+ else this += highlightKeyword(" class " ) += highlightType (name)
161161
162162 if (! flags.is(Flags .Module )) {
163163 for paramClause <- paramss do
@@ -237,7 +237,7 @@ object SourceCode {
237237 val Some (ValDef (name, tpt, _)) = self : @ unchecked
238238 indented {
239239 val name1 = if (name == " _" ) " this" else name
240- this += " " += highlightValDef (name1) += " : "
240+ this += " " += highlightDefinition (name1) += " : "
241241 printTypeTree(tpt)(using Some (cdef.symbol))
242242 this += " =>"
243243 }
@@ -279,7 +279,7 @@ object SourceCode {
279279 else this += highlightKeyword(" val " )
280280
281281 val name1 = splicedName(vdef.symbol).getOrElse(name)
282- this += highlightValDef (name1) += " : "
282+ this += highlightDefinition (name1) += " : "
283283 printTypeTree(tpt)
284284 rhs match {
285285 case Some (tree) =>
@@ -315,7 +315,7 @@ object SourceCode {
315315 printProtectedOrPrivate(ddef)
316316
317317 val name1 : String = if (isConstructor) " this" else splicedName(ddef.symbol).getOrElse(name)
318- this += highlightKeyword(" def " ) += highlightValDef (name1)
318+ this += highlightKeyword(" def " ) += highlightDefinition (name1)
319319 for clause <- paramss do
320320 clause match
321321 case TermParamClause (params) => printMethdArgsDefs(params)
@@ -337,7 +337,7 @@ object SourceCode {
337337
338338 case tree : Ident =>
339339 splicedName(tree.symbol) match {
340- case Some (name) => this += highlightTypeDef (name)
340+ case Some (name) => this += highlightType (name)
341341 case _ => printType(tree.tpe)
342342 }
343343
@@ -438,7 +438,7 @@ object SourceCode {
438438 printTree(term)
439439 term match {
440440 case Repeated (_, _) | Inlined (None , Nil , Repeated (_, _)) => this
441- case _ => this += " : " += highlightTypeDef (" _*" )
441+ case _ => this += " : " += highlightType (" _*" )
442442 }
443443 case _ =>
444444 inParens {
@@ -764,9 +764,9 @@ object SourceCode {
764764
765765 if (isDef) {
766766 if (argDef.symbol.flags.is(Flags .Covariant )) {
767- this += highlightValDef (" +" )
767+ this += highlightDefinition (" +" )
768768 } else if (argDef.symbol.flags.is(Flags .Contravariant )) {
769- this += highlightValDef (" -" )
769+ this += highlightDefinition (" -" )
770770 }
771771 }
772772
@@ -873,26 +873,26 @@ object SourceCode {
873873 printedPrefix = true
874874 }
875875 printedPrefix |= printProtectedOrPrivate(vdef)
876- if (vdef.symbol.flags.is(Flags .Mutable )) this += highlightValDef (" var " )
877- else if (printedPrefix || ! vdef.symbol.flags.is(Flags .CaseAccessor )) this += highlightValDef (" val " )
876+ if (vdef.symbol.flags.is(Flags .Mutable )) this += highlightDefinition (" var " )
877+ else if (printedPrefix || ! vdef.symbol.flags.is(Flags .CaseAccessor )) this += highlightDefinition (" val " )
878878 }
879879 }
880880 end if
881881
882- this += highlightValDef (name) += " : "
882+ this += highlightDefinition (name) += " : "
883883 printTypeTree(arg.tpt)
884884 }
885885
886886 private def printCaseDef (caseDef : CaseDef ): this .type = {
887- this += highlightValDef (" case " )
887+ this += highlightDefinition (" case " )
888888 printPattern(caseDef.pattern)
889889 caseDef.guard match {
890890 case Some (t) =>
891891 this += " if "
892892 printTree(t)
893893 case None =>
894894 }
895- this += highlightValDef (" =>" )
895+ this += highlightDefinition (" =>" )
896896 indented {
897897 caseDef.rhs match {
898898 case Block (stats, expr) =>
@@ -906,9 +906,9 @@ object SourceCode {
906906 }
907907
908908 private def printTypeCaseDef (caseDef : TypeCaseDef ): this .type = {
909- this += highlightValDef (" case " )
909+ this += highlightDefinition (" case " )
910910 printTypeTree(caseDef.pattern)
911- this += highlightValDef (" => " )
911+ this += highlightDefinition (" => " )
912912 printTypeTree(caseDef.rhs)
913913 this
914914 }
@@ -921,7 +921,7 @@ object SourceCode {
921921 this += name
922922
923923 case Bind (name, Typed (Wildcard (), tpt)) =>
924- this += highlightValDef (name) += " : "
924+ this += highlightDefinition (name) += " : "
925925 printTypeTree(tpt)
926926
927927 case Bind (name, pattern) =>
@@ -972,8 +972,8 @@ object SourceCode {
972972 case LongConstant (v) => this += highlightLiteral(v.toString + " L" )
973973 case FloatConstant (v) => this += highlightLiteral(v.toString + " f" )
974974 case DoubleConstant (v) => this += highlightLiteral(v.toString)
975- case CharConstant (v) => this += highlightString (Chars .escapedChar(v))
976- case StringConstant (v) => this += highlightString (Chars .escapedString(v, quoted = true ))
975+ case CharConstant (v) => this += highlightLiteral (Chars .escapedChar(v))
976+ case StringConstant (v) => this += highlightLiteral (Chars .escapedString(v, quoted = true ))
977977 case ClassOfConstant (v) =>
978978 this += " classOf"
979979 inSquare(printType(v))
@@ -1027,10 +1027,10 @@ object SourceCode {
10271027 printType(tree.tpe)
10281028
10291029 case TypeSelect (qual, name) =>
1030- printTree(qual) += " ." += highlightTypeDef (name)
1030+ printTree(qual) += " ." += highlightType (name)
10311031
10321032 case TypeProjection (qual, name) =>
1033- printTypeTree(qual) += " #" += highlightTypeDef (name)
1033+ printTypeTree(qual) += " #" += highlightType (name)
10341034
10351035 case Singleton (ref) =>
10361036 printTree(ref)
@@ -1053,7 +1053,7 @@ object SourceCode {
10531053 case tpe : TypeRef if tpe.typeSymbol == Symbol .requiredClass(" scala.annotation.internal.Repeated" ) =>
10541054 val Types .Sequence (tp) = tpt.tpe: @ unchecked
10551055 printType(tp)
1056- this += highlightTypeDef (" *" )
1056+ this += highlightType (" *" )
10571057 case _ =>
10581058 printTypeTree(tpt)
10591059 this += " "
@@ -1066,16 +1066,16 @@ object SourceCode {
10661066 inBlock(printTypeCases(cases, lineBreak()))
10671067
10681068 case ByName (result) =>
1069- this += highlightTypeDef (" => " )
1069+ this += highlightType (" => " )
10701070 printTypeTree(result)
10711071
10721072 case LambdaTypeTree (tparams, body) =>
10731073 printTargsDefs(tparams.zip(tparams), isDef = false )
1074- this += highlightTypeDef (" =>> " )
1074+ this += highlightType (" =>> " )
10751075 printTypeOrBoundsTree(body)
10761076
10771077 case TypeBind (name, _) =>
1078- this += highlightTypeDef (name)
1078+ this += highlightType (name)
10791079
10801080 case TypeBlock (_, tpt) =>
10811081 printTypeTree(tpt)
@@ -1121,23 +1121,23 @@ object SourceCode {
11211121 printType(prefix)
11221122 this += " ."
11231123 }
1124- this += highlightTypeDef (sym.name.stripSuffix(" $" ))
1124+ this += highlightType (sym.name.stripSuffix(" $" ))
11251125
11261126 case TermRef (prefix, name) =>
11271127 if fullNames then
11281128 prefix match {
11291129 case NoPrefix () =>
1130- this += highlightTypeDef (name)
1130+ this += highlightType (name)
11311131 case ThisType (tp) if tp.typeSymbol == defn.RootClass || tp.typeSymbol == defn.EmptyPackageClass =>
1132- this += highlightTypeDef (name)
1132+ this += highlightType (name)
11331133 case _ =>
11341134 printType(prefix)
11351135 if (name != " package" )
1136- this += " ." += highlightTypeDef (name)
1136+ this += " ." += highlightType (name)
11371137 this
11381138 }
11391139 else
1140- this += highlightTypeDef (name)
1140+ this += highlightType (name)
11411141
11421142 case tpe @ Refinement (_, _, _) =>
11431143 printRefinement(tpe)
@@ -1175,12 +1175,12 @@ object SourceCode {
11751175
11761176 case AndType (left, right) =>
11771177 printType(left)
1178- this += highlightTypeDef (" & " )
1178+ this += highlightType (" & " )
11791179 printType(right)
11801180
11811181 case OrType (left, right) =>
11821182 printType(left)
1183- this += highlightTypeDef (" | " )
1183+ this += highlightType (" | " )
11841184 printType(right)
11851185
11861186 case MatchType (bound, scrutinee, cases) =>
@@ -1189,14 +1189,14 @@ object SourceCode {
11891189 inBlock(printTypes(cases, lineBreak()))
11901190
11911191 case ByNameType (tp) =>
1192- this += highlightTypeDef (" => " )
1192+ this += highlightType (" => " )
11931193 printType(tp)
11941194
11951195 case ThisType (tp) =>
11961196 tp match {
11971197 case tp : TypeRef if ! tp.typeSymbol.flags.is(Flags .Module ) =>
11981198 printFullClassName(tp)
1199- this += highlightTypeDef (" .this" )
1199+ this += highlightType (" .this" )
12001200 case TypeRef (prefix, name) if name.endsWith(" $" ) =>
12011201 if (fullNames){
12021202 prefix match {
@@ -1207,18 +1207,18 @@ object SourceCode {
12071207 this += " ."
12081208 }
12091209 }
1210- this += highlightTypeDef (name.stripSuffix(" $" ))
1210+ this += highlightType (name.stripSuffix(" $" ))
12111211 case _ =>
12121212 printType(tp)
12131213 }
12141214
12151215 case SuperType (thistpe, supertpe) =>
12161216 printType(thistpe)
1217- this += highlightTypeDef (" .super" )
1217+ this += highlightType (" .super" )
12181218
12191219 case TypeLambda (paramNames, tparams, body) =>
12201220 inSquare(printMethodicTypeParams(paramNames, tparams))
1221- this += highlightTypeDef (" =>> " )
1221+ this += highlightType (" =>> " )
12221222 printType(body)
12231223
12241224 case ParamRef (lambda, idx) =>
@@ -1232,7 +1232,7 @@ object SourceCode {
12321232 printType(tpe)
12331233
12341234 case RecursiveThis (_) =>
1235- this += highlightTypeDef (" this" )
1235+ this += highlightType (" this" )
12361236
12371237 case tpe : MethodType =>
12381238 this += " ("
@@ -1283,10 +1283,10 @@ object SourceCode {
12831283 }
12841284
12851285 private def printDefinitionName (tree : Definition ): this .type = tree match {
1286- case ValDef (name, _, _) => this += highlightValDef (name)
1287- case DefDef (name, _, _, _) => this += highlightValDef (name)
1288- case ClassDef (name, _, _, _, _) => this += highlightTypeDef (name.stripSuffix(" $" ))
1289- case TypeDef (name, _) => this += highlightTypeDef (name)
1286+ case ValDef (name, _, _) => this += highlightDefinition (name)
1287+ case DefDef (name, _, _, _) => this += highlightDefinition (name)
1288+ case ClassDef (name, _, _, _, _) => this += highlightType (name.stripSuffix(" $" ))
1289+ case TypeDef (name, _) => this += highlightType (name)
12901290 }
12911291
12921292 private def printAnnotation (annot : Term )(using elideThis : Option [Symbol ]): this .type = {
@@ -1336,13 +1336,13 @@ object SourceCode {
13361336 this += lineBreak()
13371337 info match {
13381338 case info : TypeBounds =>
1339- this += highlightKeyword(" type " ) += highlightTypeDef (name)
1339+ this += highlightKeyword(" type " ) += highlightType (name)
13401340 printBounds(info)
13411341 case ByNameType (_) | MethodType (_, _, _) | TypeLambda (_, _, _) =>
1342- this += highlightKeyword(" def " ) += highlightTypeDef (name)
1342+ this += highlightKeyword(" def " ) += highlightType (name)
13431343 printMethodicType(info)
13441344 case info : TypeRepr =>
1345- this += highlightKeyword(" val " ) += highlightValDef (name)
1345+ this += highlightKeyword(" val " ) += highlightDefinition (name)
13461346 printMethodicType(info)
13471347 }
13481348 }
0 commit comments