File tree 4 files changed +9
-9
lines changed
compiler/src/dotty/tools/dotc 4 files changed +9
-9
lines changed Original file line number Diff line number Diff line change @@ -47,7 +47,7 @@ class ScalaSettings extends Settings.SettingGroup {
47
47
val fromTasty = BooleanSetting (" -from-tasty" , " Compile classes from tasty in classpath. The arguments are used as class names." )
48
48
49
49
/** Decompiler settings */
50
- val printTasty = BooleanSetting (" -print-tasty" , " Prints the raw tasty when decompiling ." )
50
+ val printTasty = BooleanSetting (" -print-tasty" , " Prints the raw tasty." )
51
51
val printLines = BooleanSetting (" -print-lines" , " Show source code line numbers." )
52
52
53
53
/** Plugin-related setting */
Original file line number Diff line number Diff line change @@ -39,14 +39,12 @@ class DecompilationPrinter extends Phase {
39
39
val pageWidth = ctx.settings.pageWidth.value
40
40
val printLines = ctx.settings.printLines.value
41
41
42
- out.println(s " /** Decompiled from $unit */ " )
43
- val printer = new DecompilerPrinter (ctx)
44
- out.println(printer.toText(unit.tpdTree).mkString(pageWidth, printLines))
45
-
46
42
if (ctx.settings.printTasty.value) {
47
- out.println(" /*" )
48
43
new TastyPrinter (unit.pickled.head._2).printContents()
49
- out.println(" */" )
44
+ } else {
45
+ out.println(s " /** Decompiled from $unit */ " )
46
+ val printer = new DecompilerPrinter (ctx)
47
+ out.println(printer.toText(unit.tpdTree).mkString(pageWidth, printLines))
50
48
}
51
49
}
52
50
}
Original file line number Diff line number Diff line change @@ -85,6 +85,7 @@ case "$1" in
85
85
-repl) PROG_NAME=" $ReplMain " && shift ;;
86
86
-compile) PROG_NAME=" $CompilerMain " && shift ;;
87
87
-decompile) PROG_NAME=" $DecompilerMain " && shift ;;
88
+ -print-tasty) PROG_NAME=" $DecompilerMain " && shift ;;
88
89
-run) PROG_NAME=" $ReplMain " && shift ;;
89
90
-bootcp) bootcp=true && shift ;;
90
91
-nobootcp) unset bootcp && shift ;;
Original file line number Diff line number Diff line change @@ -658,18 +658,19 @@ object Build {
658
658
val dottyCompiler = jars(" dotty-compiler" )
659
659
val args0 : List [String ] = spaceDelimited(" <arg>" ).parsed.toList
660
660
val decompile = args0.contains(" -decompile" )
661
+ val printTasty = args0.contains(" -print-tasty" )
661
662
val debugFromTasty = args0.contains(" -Ythrough-tasty" )
662
663
val args = args0.filter(arg => arg != " -repl" && arg != " -decompile" &&
663
664
arg != " -with-compiler" && arg != " -Ythrough-tasty" )
664
665
665
666
val main =
666
667
if (repl) " dotty.tools.repl.Main"
667
- else if (decompile) " dotty.tools.dotc.decompiler.Main"
668
+ else if (decompile || printTasty ) " dotty.tools.dotc.decompiler.Main"
668
669
else if (debugFromTasty) " dotty.tools.dotc.fromtasty.Debug"
669
670
else " dotty.tools.dotc.Main"
670
671
671
672
var extraClasspath = dottyLib
672
- if (decompile && ! args.contains(" -classpath" )) extraClasspath += " :."
673
+ if (( decompile || printTasty) && ! args.contains(" -classpath" )) extraClasspath += " :."
673
674
if (args0.contains(" -with-compiler" )) extraClasspath += s " : $dottyCompiler"
674
675
675
676
val fullArgs = main :: insertClasspathInArgs(args, extraClasspath)
You can’t perform that action at this time.
0 commit comments