Skip to content

Commit f29e03b

Browse files
committed
Address review comments
1 parent deb9dc8 commit f29e03b

File tree

5 files changed

+6
-12
lines changed

5 files changed

+6
-12
lines changed

compiler/src/dotty/tools/dotc/core/tasty/CommentPickler.scala

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ import dotty.tools.dotc.core.tasty.TastyBuffer.Addr
88
import java.nio.charset.Charset
99

1010
class CommentPickler(pickler: TastyPickler, addrOfTree: tpd.Tree => Option[Addr])(implicit ctx: Context) {
11-
val buf = new TastyBuffer(5000)
11+
private[this] val buf = new TastyBuffer(5000)
1212
pickler.newSection("Comments", buf)
1313

1414
def pickleComment(root: tpd.Tree): Unit =
@@ -21,7 +21,7 @@ class CommentPickler(pickler: TastyPickler, addrOfTree: tpd.Tree => Option[Addr]
2121
buf.writeAddr(addr)
2222
buf.writeNat(length)
2323
buf.writeBytes(bytes, length)
24-
buf.writeBoolean(cmt.isExpanded)
24+
buf.writeByte(if (cmt.isExpanded) 1 else 0)
2525
case other =>
2626
()
2727
}

compiler/src/dotty/tools/dotc/core/tasty/CommentUnpickler.scala

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ class CommentUnpickler(reader: TastyReader) {
1919
val length = readNat()
2020
if (length > 0) {
2121
val bytes = readBytes(length)
22-
val expanded = readBoolean()
22+
val expanded = readByte() == 1
2323
val rawComment = new String(bytes, Charset.forName("UTF-8"))
2424
comments(addr) = Comment(Positions.NoPosition, rawComment, expanded = expanded)
2525
}

compiler/src/dotty/tools/dotc/core/tasty/TastyBuffer.scala

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -48,10 +48,6 @@ class TastyBuffer(initialSize: Int) {
4848

4949
// -- Output routines --------------------------------------------
5050

51-
/** Write a boolean value. */
52-
def writeBoolean(b: Boolean): Unit =
53-
writeByte(if (b) 1 else 0)
54-
5551
/** Write a byte of data. */
5652
def writeByte(b: Int): Unit = {
5753
if (length >= bytes.length)

compiler/src/dotty/tools/dotc/core/tasty/TastyFormat.scala

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -224,7 +224,9 @@ Standard Section: "Positions" Assoc*
224224
225225
Standard Section: "Comments" Comment*
226226
227-
Comment = Length Bytes // Raw comment's bytes encoded as UTF-8
227+
Comment = Length Bytes Byte // Raw comment's bytes encoded as UTF-8, plus a byte indicating
228+
// whether the comment is expanded (1) or not expanded (0)
229+
228230
229231
**************************************************************************************/
230232

compiler/src/dotty/tools/dotc/core/tasty/TastyReader.scala

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -41,10 +41,6 @@ class TastyReader(val bytes: Array[Byte], start: Int, end: Int, val base: Int =
4141
def subReader(start: Addr, end: Addr): TastyReader =
4242
new TastyReader(bytes, index(start), index(end), base)
4343

44-
/** Read a boolean value. */
45-
def readBoolean(): Boolean =
46-
readByte() == 1
47-
4844
/** Read a byte of data. */
4945
def readByte(): Int = {
5046
val result = bytes(bp) & 0xff

0 commit comments

Comments
 (0)