-
Notifications
You must be signed in to change notification settings - Fork 1.1k
Create dotc -decompiler #3485
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Create dotc -decompiler #3485
Conversation
|
60e1a38
to
e1122f5
Compare
bea98b1
to
7ac7c56
Compare
@@ -96,6 +96,7 @@ class ScalaSettings extends Settings.SettingGroup { | |||
val YnoPatmatOpt = BooleanSetting("-Yno-patmat-opt", "disable all pattern matching optimizations.") | |||
val YplainPrinter = BooleanSetting("-Yplain-printer", "Pretty-print using a plain printer.") | |||
val YprintSyms = BooleanSetting("-Yprint-syms", "when printing trees print info in symbols instead of corresponding info in trees.") | |||
val YprintNoPrivate = BooleanSetting("-Y-print-no-private", "when printing trees print do not print private/protected members.") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
should -Yprint, not -Y-print
a9e047a
to
8b9621b
Compare
* `dotc -decompile <options|classes>*`
fa12b14
to
4790d75
Compare
Rebased and squashed |
println(line) | ||
|
||
val code = unit.tpdTree.show | ||
println(if (ctx.useColors) printing.SyntaxHighlighting(code) else code) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It should really be printing.SyntaxHighlighting(code).mkString
. We shouldn't assume that the underlying Iterable[Char].toString
works as we expect.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I will remove the syntax highlighting as it is not compatible with all the output formats of show
. I will work on coloring in a separate PR.
Create infrastructure to support
dotp
tasty decompiler. The implementation of the decompiler is a tasty compiler that compiles to a text representation of the loaded code (currently with Tree.show).