File tree Expand file tree Collapse file tree 2 files changed +6
-13
lines changed
compiler/src/dotty/tools/dotc/printing Expand file tree Collapse file tree 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
1212
1313class DecompilerPrinter (_ctx : Context ) extends RefinedPrinter (_ctx) {
1414
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 )
2717
2818 override protected def blockText [T >: Untyped ](trees : List [Trees .Tree [T ]]): Text = {
2919 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) {
690690 if (homogenizedView && mods.flags.isTypeFlags) flagMask &~= Implicit // drop implicit from classes
691691 val flags = mods.flags & flagMask
692692 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)
694695 }
695696
697+ protected def filterModTextAnnots (annots : List [untpd.Tree ]): List [untpd.Tree ] = annots
698+
696699 def optText (name : Name )(encl : Text => Text ): Text =
697700 if (name.isEmpty) " " else encl(toText(name))
698701
You can’t perform that action at this time.
0 commit comments