Skip to content

Commit 743d42e

Browse files
committed
Change -Yprint-user to -Yprint-decompile
1 parent 2166012 commit 743d42e

File tree

3 files changed

+9
-9
lines changed

3 files changed

+9
-9
lines changed

compiler/src/dotty/tools/dotc/config/ScalaSettings.scala

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -102,7 +102,7 @@ class ScalaSettings extends Settings.SettingGroup {
102102
val YplainPrinter = BooleanSetting("-Yplain-printer", "Pretty-print using a plain printer.")
103103
val YprintSyms = BooleanSetting("-Yprint-syms", "when printing trees print info in symbols instead of corresponding info in trees.")
104104
val YprintDebug = BooleanSetting("-Yprint-debug", "when printing trees, print some extra information useful for debugging.")
105-
val YprintUser = BooleanSetting("-Yprint-user", "Print the program using user friendly abstractions.")
105+
val YprintDecompile = BooleanSetting("-Yprint-decompile", "Print the program using user friendly abstractions.")
106106
val YshowPrintErrors = BooleanSetting("-Yshow-print-errors", "don't suppress exceptions thrown during tree printing.")
107107
val YtestPickler = BooleanSetting("-Ytest-pickler", "self-test for pickling functionality; should be used with -Ystop-after:pickler")
108108
val YcheckReentrant = BooleanSetting("-Ycheck-reentrant", "check that compiled program does not contain vars that can be accessed from a global root.")

compiler/src/dotty/tools/dotc/decompiler/Main.scala

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,6 @@ object Main extends dotc.Driver {
1616
override def setup(args0: Array[String], rootCtx: Context): (List[String], Context) = {
1717
var args = args0.filter(a => a != "-decompile")
1818
args = if (args.contains("-from-tasty")) args else "-from-tasty" +: args
19-
super.setup("-Yprint-user" +: args, rootCtx)
19+
super.setup("-Yprint-decompile" +: args, rootCtx)
2020
}
2121
}

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

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -28,8 +28,8 @@ class RefinedPrinter(_ctx: Context) extends PlainPrinter(_ctx) {
2828
private[this] var myCtx: Context = _ctx
2929
private[this] var printPos = ctx.settings.YprintPos.value
3030
private[this] val printLines = ctx.settings.printLines.value
31-
private[this] val YprintUser =
32-
ctx.settings.YprintUser.value && !ctx.phases.dropWhile(!_.isInstanceOf[FirstTransform]).contains(ctx.phase)
31+
private[this] val YprintDecompile =
32+
ctx.settings.YprintDecompile.value && !ctx.phases.dropWhile(!_.isInstanceOf[FirstTransform]).contains(ctx.phase)
3333
override protected[this] implicit def ctx: Context = myCtx
3434

3535
def withEnclosingDef(enclDef: Tree[_ >: Untyped])(op: => Text): Text = {
@@ -276,7 +276,7 @@ class RefinedPrinter(_ctx: Context) extends PlainPrinter(_ctx) {
276276
val flags = mods.flags & flagMask
277277
val flagsText = if (flags.isEmpty) "" else keywordStr((mods.flags & flagMask).toString)
278278
val annotations =
279-
if (YprintUser) mods.annotations.filter(_.tpe != defn.SourceFileAnnotType)
279+
if (YprintDecompile) mods.annotations.filter(_.tpe != defn.SourceFileAnnotType)
280280
else mods.annotations
281281
Text(annotations.map(annotText), " ") ~~ flagsText ~~ (Str(kw) provided !suppressKw)
282282
}
@@ -422,7 +422,7 @@ class RefinedPrinter(_ctx: Context) extends PlainPrinter(_ctx) {
422422
}
423423
case Closure(env, ref, target) =>
424424
("closure(" ~ (toTextGlobal(env, ", ") ~ " | " provided env.nonEmpty) ~
425-
toTextGlobal(ref) ~ (":" ~ toText(target) provided !target.isEmpty) ~ ")").provided(!YprintUser)
425+
toTextGlobal(ref) ~ (":" ~ toText(target) provided !target.isEmpty) ~ ")").provided(!YprintDecompile)
426426
case Match(sel, cases) =>
427427
if (sel.isEmpty) blockText(cases)
428428
else changePrec(GlobalPrec) { toText(sel) ~ keywordStr(" match ") ~ blockText(cases) }
@@ -483,10 +483,10 @@ class RefinedPrinter(_ctx: Context) extends PlainPrinter(_ctx) {
483483
modText(tree.mods, keywordStr(if (tree.mods is Mutable) "var" else "val")) ~~
484484
valDefText(nameIdText(tree)) ~ optAscription(tpt) ~
485485
withEnclosingDef(tree) { optText(tree.rhs)(" = " ~ _) }
486-
}.provided(!YprintUser || !tree.symbol.is(Module))
486+
}.provided(!YprintDecompile || !tree.symbol.is(Module))
487487
case tree @ DefDef(name, tparams, vparamss, tpt, _) =>
488488
dclTextOr {
489-
val printLambda = tree.symbol.isAnonymousFunction && YprintUser
489+
val printLambda = tree.symbol.isAnonymousFunction && YprintDecompile
490490
val prefix = modText(tree.mods, keywordStr("def")) ~~ valDefText(nameIdText(tree)) provided (!printLambda)
491491
withEnclosingDef(tree) {
492492
addVparamssText(prefix ~ tparamsText(tparams), vparamss) ~ optAscription(tpt).provided(!printLambda) ~
@@ -502,7 +502,7 @@ class RefinedPrinter(_ctx: Context) extends PlainPrinter(_ctx) {
502502
def recur(rhs: Tree, tparamsTxt: => Text): Text = rhs match {
503503
case impl: Template =>
504504
val decl =
505-
if (!YprintUser || !tree.mods.is(Module)) modText(tree.mods, keywordStr(if ((tree).mods is Trait) "trait" else "class"))
505+
if (!YprintDecompile || !tree.mods.is(Module)) modText(tree.mods, keywordStr(if ((tree).mods is Trait) "trait" else "class"))
506506
else modText(tree.mods &~ (Final | Module), keywordStr("object"))
507507
decl ~~ typeText(nameIdText(tree)) ~ withEnclosingDef(tree) { toTextTemplate(impl) } ~
508508
(if (tree.hasType && ctx.settings.verbose.value) i"[decls = ${tree.symbol.info.decls}]" else "")

0 commit comments

Comments
 (0)