File tree 1 file changed +14
-0
lines changed
compiler/src/dotty/tools/dotc/core/tasty 1 file changed +14
-0
lines changed Original file line number Diff line number Diff line change @@ -34,6 +34,7 @@ class TastyPrinter(bytes: Array[Byte])(implicit ctx: Context) {
34
34
println(" Trees:" )
35
35
unpickle(new TreeSectionUnpickler )
36
36
unpickle(new PositionSectionUnpickler )
37
+ unpickle(new CommentSectionUnpickler )
37
38
}
38
39
39
40
class TreeSectionUnpickler extends SectionUnpickler [Unit ](" ASTs" ) {
@@ -120,6 +121,19 @@ class TastyPrinter(bytes: Array[Byte])(implicit ctx: Context) {
120
121
}
121
122
}
122
123
124
+ class CommentSectionUnpickler extends SectionUnpickler [Unit ](" Comments" ) {
125
+ def unpickle (reader : TastyReader , tastyName : NameTable ): Unit = {
126
+ print(s " ${reader.endAddr.index - reader.currentAddr.index}" )
127
+ val comments = new CommentUnpickler (reader).comments
128
+ println(s " comment bytes: " )
129
+ val sorted = comments.toSeq.sortBy(_._1.index)
130
+ for ((addr, cmt) <- sorted) {
131
+ print(treeColor(" %10d" .format(addr.index)))
132
+ println(s " : ${cmt.raw} (expanded = ${cmt.isExpanded}) " )
133
+ }
134
+ }
135
+ }
136
+
123
137
private def nameColor (str : String ): String = Magenta (str).show
124
138
private def treeColor (str : String ): String = Yellow (str).show
125
139
private def lengthColor (str : String ): String = Cyan (str).show
You can’t perform that action at this time.
0 commit comments