File tree 2 files changed +6
-13
lines changed
compiler/src/dotty/tools/dotc/printing 2 files changed +6
-13
lines changed Original file line number Diff line number Diff line change @@ -12,18 +12,8 @@ import scala.language.implicitConversions
12
12
13
13
class DecompilerPrinter (_ctx : Context ) extends RefinedPrinter (_ctx) {
14
14
15
- override protected def modText (mods : untpd.Modifiers , kw : String ): Text = { // DD
16
- val suppressKw = if (enclDefIsClass) mods is ParamAndLocal else mods is Param
17
- var flagMask =
18
- if (ctx.settings.YdebugFlags .value) AnyFlags
19
- else if (suppressKw) PrintableFlags &~ Private
20
- else PrintableFlags
21
- if (homogenizedView && mods.flags.isTypeFlags) flagMask &~= Implicit // drop implicit from classes
22
- val flags = mods.flags & flagMask
23
- val flagsText = if (flags.isEmpty) " " else keywordStr((mods.flags & flagMask).toString)
24
- val annotations = mods.annotations.filter(_.tpe != defn.SourceFileAnnotType )
25
- Text (annotations.map(annotText), " " ) ~~ flagsText ~~ (Str (kw) provided ! suppressKw)
26
- }
15
+ override protected def filterModTextAnnots (annots : List [untpd.Tree ]): List [untpd.Tree ] =
16
+ annots.filter(_.tpe != defn.SourceFileAnnotType )
27
17
28
18
override protected def blockText [T >: Untyped ](trees : List [Trees .Tree [T ]]): Text = {
29
19
super .blockText(trees.filterNot(_.isInstanceOf [Closure [_]]))
Original file line number Diff line number Diff line change @@ -690,9 +690,12 @@ class RefinedPrinter(_ctx: Context) extends PlainPrinter(_ctx) {
690
690
if (homogenizedView && mods.flags.isTypeFlags) flagMask &~= Implicit // drop implicit from classes
691
691
val flags = mods.flags & flagMask
692
692
val flagsText = if (flags.isEmpty) " " else keywordStr((mods.flags & flagMask).toString)
693
- Text (mods.annotations.map(annotText), " " ) ~~ flagsText ~~ (Str (kw) provided ! suppressKw)
693
+ val annotations = filterModTextAnnots(mods.annotations)
694
+ Text (annotations.map(annotText), " " ) ~~ flagsText ~~ (Str (kw) provided ! suppressKw)
694
695
}
695
696
697
+ protected def filterModTextAnnots (annots : List [untpd.Tree ]): List [untpd.Tree ] = annots
698
+
696
699
def optText (name : Name )(encl : Text => Text ): Text =
697
700
if (name.isEmpty) " " else encl(toText(name))
698
701
You can’t perform that action at this time.
0 commit comments