Skip to content

Commit d4a6ab6

Browse files
committed
Add -Yprint-tasty compiler flag
This flag provides a simple way to print the generated TASTy. Unlike `Printers.pickling`, this can be used on a release version of the compiler.
1 parent 916d4e7 commit d4a6ab6

File tree

2 files changed

+3
-1
lines changed

2 files changed

+3
-1
lines changed

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

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -353,6 +353,7 @@ private sealed trait YSettings:
353353
val YprintDebugOwners: Setting[Boolean] = BooleanSetting("-Yprint-debug-owners", "When printing trees, print owners of definitions.")
354354
val YprintLevel: Setting[Boolean] = BooleanSetting("-Yprint-level", "print nesting levels of symbols and type variables.")
355355
val YshowPrintErrors: Setting[Boolean] = BooleanSetting("-Yshow-print-errors", "Don't suppress exceptions thrown during tree printing.")
356+
val YprintTasty: Setting[Boolean] = BooleanSetting("-Yprint-tasty", "Prints the generated TASTY to stdout.")
356357
val YtestPickler: Setting[Boolean] = BooleanSetting("-Ytest-pickler", "Self-test for pickling functionality; should be used with -Ystop-after:pickler.")
357358
val YcheckReentrant: Setting[Boolean] = BooleanSetting("-Ycheck-reentrant", "Check that compiled program does not contain vars that can be accessed from a global root.")
358359
val YdropComments: Setting[Boolean] = BooleanSetting("-Ydrop-docs", "Drop documentation when scanning source files.", aliases = List("-Ydrop-comments"))

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

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -116,9 +116,10 @@ class Pickler extends Phase {
116116
}
117117

118118
// println(i"rawBytes = \n$rawBytes%\n%") // DEBUG
119-
if pickling ne noPrinter then
119+
if ctx.settings.YprintTasty.value || pickling != noPrinter then
120120
println(i"**** pickled info of $cls")
121121
println(TastyPrinter.showContents(pickled, ctx.settings.color.value == "never"))
122+
println(i"**** end of pickled info of $cls")
122123
pickled
123124
}
124125
}

0 commit comments

Comments
 (0)