Skip to content

Commit df2ff53

Browse files
committed
Slight refactoring of context handling in printers
1 parent 689bd3e commit df2ff53

File tree

3 files changed

+7
-2
lines changed

3 files changed

+7
-2
lines changed

compiler/src/dotty/tools/dotc/printing/PlainPrinter.scala

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,11 @@ import scala.util.control.NonFatal
1515
import scala.annotation.switch
1616

1717
class PlainPrinter(_ctx: Context) extends Printer {
18+
/** The context of all public methods in Printer and subclasses.
19+
* Overridden in RefinedPrinter.
20+
*/
1821
protected implicit def ctx: Context = _ctx.addMode(Mode.Printing)
22+
1923
protected def printDebug = ctx.settings.YprintDebug.value
2024

2125
private var openRecs: List[RecType] = Nil

compiler/src/dotty/tools/dotc/printing/RefinedPrinter.scala

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -714,12 +714,12 @@ class RefinedPrinter(_ctx: Context) extends PlainPrinter(_ctx) {
714714
}
715715

716716
/** Print modifiers from symbols if tree has type, overriding the untpd behavior. */
717-
implicit def modsDeco(mdef: untpd.DefTree)(implicit ctx: Context): untpd.ModsDecorator =
717+
private implicit def modsDeco(mdef: untpd.DefTree): untpd.ModsDecorator =
718718
new untpd.ModsDecorator {
719719
def mods = if (mdef.hasType) Modifiers(mdef.symbol) else mdef.rawMods
720720
}
721721

722-
def Modifiers(sym: Symbol)(implicit ctx: Context): Modifiers = untpd.Modifiers(
722+
private def Modifiers(sym: Symbol): Modifiers = untpd.Modifiers(
723723
sym.flags & (if (sym.isType) ModifierFlags | VarianceFlags else ModifierFlags),
724724
if (sym.privateWithin.exists) sym.privateWithin.asType.name else tpnme.EMPTY,
725725
sym.annotations.filterNot(ann => dropAnnotForModText(ann.symbol)).map(_.tree))

compiler/src/dotty/tools/dotc/transform/ExplicitOuter.scala

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -346,6 +346,7 @@ object ExplicitOuter {
346346
* no later than erasure.
347347
*/
348348
class OuterOps(val ictx: Context) extends AnyVal {
349+
/** The context of all operations of this class */
349350
private implicit def ctx: Context = ictx
350351

351352
/** If `cls` has an outer parameter add one to the method type `tp`. */

0 commit comments

Comments
 (0)