Skip to content

Commit aaf019f

Browse files
committed
Change -Yprint-user to -Yprint-decompile
1 parent e586281 commit aaf019f

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
@@ -101,7 +101,7 @@ class ScalaSettings extends Settings.SettingGroup {
101101
val YplainPrinter = BooleanSetting("-Yplain-printer", "Pretty-print using a plain printer.")
102102
val YprintSyms = BooleanSetting("-Yprint-syms", "when printing trees print info in symbols instead of corresponding info in trees.")
103103
val YprintDebug = BooleanSetting("-Yprint-debug", "when printing trees, print some extra information useful for debugging.")
104-
val YprintUser = BooleanSetting("-Yprint-user", "Print the program using user friendly abstractions.")
104+
val YprintDecompile = BooleanSetting("-Yprint-decompile", "Print the program using user friendly abstractions.")
105105
val YshowPrintErrors = BooleanSetting("-Yshow-print-errors", "don't suppress exceptions thrown during tree printing.")
106106
val YtestPickler = BooleanSetting("-Ytest-pickler", "self-test for pickling functionality; should be used with -Ystop-after:pickler")
107107
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 = {
@@ -282,7 +282,7 @@ class RefinedPrinter(_ctx: Context) extends PlainPrinter(_ctx) {
282282
val flags = mods.flags & flagMask
283283
val flagsText = if (flags.isEmpty) "" else keywordStr((mods.flags & flagMask).toString)
284284
val annotations =
285-
if (YprintUser) mods.annotations.filter(_.tpe != defn.SourceFileAnnotType)
285+
if (YprintDecompile) mods.annotations.filter(_.tpe != defn.SourceFileAnnotType)
286286
else mods.annotations
287287
Text(annotations.map(annotText), " ") ~~ flagsText ~~ (Str(kw) provided !suppressKw)
288288
}
@@ -428,7 +428,7 @@ class RefinedPrinter(_ctx: Context) extends PlainPrinter(_ctx) {
428428
}
429429
case Closure(env, ref, target) =>
430430
("closure(" ~ (toTextGlobal(env, ", ") ~ " | " provided env.nonEmpty) ~
431-
toTextGlobal(ref) ~ (":" ~ toText(target) provided !target.isEmpty) ~ ")").provided(!YprintUser)
431+
toTextGlobal(ref) ~ (":" ~ toText(target) provided !target.isEmpty) ~ ")").provided(!YprintDecompile)
432432
case Match(sel, cases) =>
433433
if (sel.isEmpty) blockText(cases)
434434
else changePrec(GlobalPrec) { toText(sel) ~ keywordStr(" match ") ~ blockText(cases) }
@@ -489,10 +489,10 @@ class RefinedPrinter(_ctx: Context) extends PlainPrinter(_ctx) {
489489
modText(tree.mods, keywordStr(if (tree.mods is Mutable) "var" else "val")) ~~
490490
valDefText(nameIdText(tree)) ~ optAscription(tpt) ~
491491
withEnclosingDef(tree) { optText(tree.rhs)(" = " ~ _) }
492-
}.provided(!YprintUser || !tree.symbol.is(Module))
492+
}.provided(!YprintDecompile || !tree.symbol.is(Module))
493493
case tree @ DefDef(name, tparams, vparamss, tpt, _) =>
494494
dclTextOr {
495-
val printLambda = tree.symbol.isAnonymousFunction && YprintUser
495+
val printLambda = tree.symbol.isAnonymousFunction && YprintDecompile
496496
val prefix = modText(tree.mods, keywordStr("def")) ~~ valDefText(nameIdText(tree)) provided (!printLambda)
497497
withEnclosingDef(tree) {
498498
addVparamssText(prefix ~ tparamsText(tparams), vparamss) ~ optAscription(tpt).provided(!printLambda) ~
@@ -508,7 +508,7 @@ class RefinedPrinter(_ctx: Context) extends PlainPrinter(_ctx) {
508508
def recur(rhs: Tree, tparamsTxt: => Text): Text = rhs match {
509509
case impl: Template =>
510510
val decl =
511-
if (!YprintUser || !tree.mods.is(Module)) modText(tree.mods, keywordStr(if ((tree).mods is Trait) "trait" else "class"))
511+
if (!YprintDecompile || !tree.mods.is(Module)) modText(tree.mods, keywordStr(if ((tree).mods is Trait) "trait" else "class"))
512512
else modText(tree.mods &~ (Final | Module), keywordStr("object"))
513513
decl ~~ typeText(nameIdText(tree)) ~ withEnclosingDef(tree) { toTextTemplate(impl) } ~
514514
(if (tree.hasType && ctx.settings.verbose.value) i"[decls = ${tree.symbol.info.decls}]" else "")

0 commit comments

Comments
 (0)