@@ -36,11 +36,6 @@ class RefinedPrinter(_ctx: Context) extends PlainPrinter(_ctx) {
36
36
}
37
37
}
38
38
39
- def homogenize (tree : Tree [_])(implicit ctx : Context ) = tree match {
40
- case tree : tpd.Inlined if homogenizedView => Inliner .dropInlined(tree)
41
- case _ => tree
42
- }
43
-
44
39
private def enclDefIsClass = enclosingDef match {
45
40
case owner : TypeDef [_] => owner.isClassDef
46
41
case owner : untpd.ModuleDef => true
@@ -159,7 +154,7 @@ class RefinedPrinter(_ctx: Context) extends PlainPrinter(_ctx) {
159
154
}
160
155
161
156
def blockText [T >: Untyped ](trees : List [Tree [T ]]): Text =
162
- " {" ~ toText(trees, " \n " ) ~ " }"
157
+ ( " {" ~ toText(trees, " \n " ) ~ " }" ).close
163
158
164
159
override def toText [T >: Untyped ](tree : Tree [T ]): Text = controlled {
165
160
@@ -274,7 +269,7 @@ class RefinedPrinter(_ctx: Context) extends PlainPrinter(_ctx) {
274
269
if (homogenizedView && pid.hasType) toTextLocal(pid.tpe)
275
270
else toTextLocal(pid)
276
271
277
- var txt : Text = homogenize( tree) match {
272
+ def toTextCore ( tree : Tree ) : Text = tree match {
278
273
case id : Trees .BackquotedIdent [_] if ! homogenizedView =>
279
274
" `" ~ toText(id.name) ~ " `"
280
275
case Ident (name) =>
@@ -349,8 +344,9 @@ class RefinedPrinter(_ctx: Context) extends PlainPrinter(_ctx) {
349
344
}
350
345
case SeqLiteral (elems, elemtpt) =>
351
346
" [" ~ toTextGlobal(elems, " ," ) ~ " : " ~ toText(elemtpt) ~ " ]"
352
- case Inlined (call, bindings, body) =>
353
- " /* inlined from " ~ toText(call) ~ " */ " ~ blockText(bindings :+ body)
347
+ case tree @ Inlined (call, bindings, body) =>
348
+ if (homogenizedView) toTextCore(Inliner .dropInlined(tree.asInstanceOf [tpd.Inlined ]))
349
+ else " /* inlined from " ~ toText(call) ~ " */ " ~ blockText(bindings :+ body)
354
350
case tpt : untpd.DerivedTypeTree =>
355
351
" <derived typetree watching " ~ summarized(toText(tpt.watched)) ~ " >"
356
352
case TypeTree (orig) =>
@@ -518,13 +514,14 @@ class RefinedPrinter(_ctx: Context) extends PlainPrinter(_ctx) {
518
514
case _ =>
519
515
tree.fallbackToText(this )
520
516
}
517
+ var txt = toTextCore(tree)
521
518
if (ctx.settings.printtypes.value && tree.hasType) {
522
519
val tp = tree.typeOpt match {
523
520
case tp : TermRef if tree.isInstanceOf [RefTree ] && ! tp.denot.isOverloaded => tp.underlying
524
521
case tp => tp
525
522
}
526
523
if (tree.isType) txt = toText(tp)
527
- else if (! tree.isDef) txt = " <" ~ txt ~ " :" ~ toText(tp) ~ " >"
524
+ else if (! tree.isDef) txt = ( " <" ~ txt ~ " :" ~ toText(tp) ~ " >" ).close
528
525
}
529
526
if (ctx.settings.Yprintpos .value && ! tree.isInstanceOf [WithoutTypeOrPos [_]])
530
527
txt = txt ~ " @" ~ tree.pos.toString
0 commit comments