File tree Expand file tree Collapse file tree 1 file changed +14
-0
lines changed
compiler/src/dotty/tools/dotc/core/tasty Expand file tree Collapse file tree 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) {
3434 println(" Trees:" )
3535 unpickle(new TreeSectionUnpickler )
3636 unpickle(new PositionSectionUnpickler )
37+ unpickle(new CommentSectionUnpickler )
3738 }
3839
3940 class TreeSectionUnpickler extends SectionUnpickler [Unit ](" ASTs" ) {
@@ -120,6 +121,19 @@ class TastyPrinter(bytes: Array[Byte])(implicit ctx: Context) {
120121 }
121122 }
122123
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+
123137 private def nameColor (str : String ): String = Magenta (str).show
124138 private def treeColor (str : String ): String = Yellow (str).show
125139 private def lengthColor (str : String ): String = Cyan (str).show
You can’t perform that action at this time.
0 commit comments