File tree Expand file tree Collapse file tree 3 files changed +10
-2
lines changed
compiler/src/dotty/tools/dotc/core/tasty
tasty/src/dotty/tools/tasty Expand file tree Collapse file tree 3 files changed +10
-2
lines changed Original file line number Diff line number Diff line change @@ -3,7 +3,7 @@ package dotty.tools.dotc.core.tasty
3
3
import dotty .tools .dotc .ast .{tpd , untpd }
4
4
5
5
import dotty .tools .tasty .TastyBuffer
6
- import dotty .tools .tasty .TastyFormat .AttributesSection
6
+ import dotty .tools .tasty .TastyFormat , TastyFormat .AttributesSection
7
7
8
8
import java .nio .charset .StandardCharsets
9
9
@@ -19,6 +19,7 @@ object AttributePickler:
19
19
val bytes = attribute.getBytes(StandardCharsets .UTF_8 ).nn
20
20
val length = bytes.length
21
21
assert(" [a-zA-Z0-9]+" .r.matches(attribute), s " Malformed attribute: $attribute\n . Attribute must match [a-zA-Z0-9]+ " )
22
+ buf.writeNat(TastyFormat .FLAGattr )
22
23
buf.writeNat(length)
23
24
buf.writeBytes(bytes, length)
24
25
end pickleAttributes
Original file line number Diff line number Diff line change @@ -13,6 +13,8 @@ class AttributeUnpickler(reader: TastyReader):
13
13
private [tasty] lazy val attributes : List [String ] = {
14
14
val attributesBuilder = List .newBuilder[String ]
15
15
while (! isAtEnd) {
16
+ val kind = readNat()
17
+ assert(kind == TastyFormat .FLAGattr , " Malformed attribute kind" )
16
18
val length = readNat()
17
19
val bytes = readBytes(length)
18
20
val attribute = new String (bytes, StandardCharsets .UTF_8 )
Original file line number Diff line number Diff line change @@ -270,7 +270,7 @@ Standard Section: "Comments" Comment*
270
270
271
271
Standard Section: "Attributes" Attribute*
272
272
```none
273
- Attribute = UTF8 // attributes match the regex [a-zA-Z0-9]+
273
+ Attribute = FLAGattr UTF8 // attributes match the regex [a-zA-Z0-9]+
274
274
```
275
275
276
276
**************************************************************************************/
@@ -606,6 +606,11 @@ object TastyFormat {
606
606
final val firstNatASTTreeTag = IDENT
607
607
final val firstLengthTreeTag = PACKAGE
608
608
609
+
610
+ // Attribute tags
611
+
612
+ final val FLAGattr = 1
613
+
609
614
/** Useful for debugging */
610
615
def isLegalTag (tag : Int ): Boolean =
611
616
firstSimpleTreeTag <= tag && tag <= SPLITCLAUSE ||
You can’t perform that action at this time.
0 commit comments