Skip to content

Commit 4803bb9

Browse files
committed
Use BitSet for boolean TASTy attributes
1 parent e7f8a2c commit 4803bb9

File tree

2 files changed

+6
-3
lines changed

2 files changed

+6
-3
lines changed

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

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,14 +2,15 @@ package dotty.tools.dotc
22
package core.tasty
33

44
import scala.language.unsafeNulls
5+
import scala.collection.immutable.BitSet
56

67
import dotty.tools.tasty.{TastyFormat, TastyReader, TastyBuffer}
78

89
class AttributeUnpickler(reader: TastyReader):
910
import reader._
1011

1112
lazy val attributes: Attributes = {
12-
val booleanTags = List.newBuilder[Int]
13+
val booleanTags = BitSet.newBuilder
1314

1415
while !isAtEnd do
1516
booleanTags += readByte()

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

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,10 @@ package dotty.tools.dotc.core.tasty
22

33
import dotty.tools.tasty.TastyFormat
44

5+
import scala.collection.immutable.BitSet
6+
57
class Attributes(
6-
val booleanTags: List[Int],
8+
val booleanTags: BitSet,
79
) {
810
def scala2StandardLibrary: Boolean =
911
booleanTags.contains(TastyFormat.SCALA2STANDARDLIBRARYattr)
@@ -16,7 +18,7 @@ object Attributes:
1618
scala2StandardLibrary: Boolean,
1719
explicitNulls: Boolean,
1820
): Attributes =
19-
val booleanTags = List.newBuilder[Int]
21+
val booleanTags = BitSet.newBuilder
2022
if scala2StandardLibrary then booleanTags += TastyFormat.SCALA2STANDARDLIBRARYattr
2123
if explicitNulls then booleanTags += TastyFormat.EXPLICITNULLSattr
2224
new Attributes(booleanTags.result())

0 commit comments

Comments
 (0)