diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/dotty/tools/dotc/core/pickling/PickleFormat.scala | 10 | ||||
-rw-r--r-- | src/dotty/tools/dotc/core/pickling/TreePickler.scala | 14 |
2 files changed, 14 insertions, 10 deletions
diff --git a/src/dotty/tools/dotc/core/pickling/PickleFormat.scala b/src/dotty/tools/dotc/core/pickling/PickleFormat.scala index decc9a887..9e4992ffd 100644 --- a/src/dotty/tools/dotc/core/pickling/PickleFormat.scala +++ b/src/dotty/tools/dotc/core/pickling/PickleFormat.scala @@ -81,13 +81,13 @@ Standard-Section: "ASTs" Tree* BIND Length boundName_NameRef patType_Type pat_Term ALTERNATIVE Length alt_Term* UNAPPLY Length fun_Term ImplicitArg* pat_Term* - ANNOTATED Length annot_Term underlying_Term EMPTYTREE CaseDef = CASEDEF Length pat_Tree guard_Tree rhs_Tree ImplicitArg = IMPLICITARG Length arg_Tree Template = TEMPLATE Length parent_Tree* SelfDef? Stat* // Stat* always starts with the primary constructor. SelfDef = Param + Annotation = ANNOTATION Length tycon_Symbol fullAnnotation_Tree ASTRef = Nat // byte position in AST payload Path = Constant @@ -174,7 +174,7 @@ Standard-Section: "ASTs" Tree* DEFAULTparameterized // Method with default params DEFAULTinit // variable with “_” initializer INSUPERCALL // defined the argument of a constructor supercall - annotation_Term + Annotation Note: Tree tags are grouped into 4 categories that determine what follows, and thus allow to compute the size of the tagged tree in a generic way. @@ -320,8 +320,9 @@ object PickleFormat { final val POLYtype = 175 final val PARAMtype = 176 final val IMPLICITARG = 177 - final val PRIVATEqualified = 178 - final val PROTECTEDqualified = 179 + final val ANNOTATION = 178 + final val PRIVATEqualified = 179 + final val PROTECTEDqualified = 180 final val firstSimpleTreeTag = EMPTYTREE final val firstNatTreeTag = SHARED @@ -450,6 +451,7 @@ object PickleFormat { case METHODtype => "METHODtype" case PARAMtype => "PARAMtype" case IMPLICITARG => "IMPLICITARG" + case ANNOTATION => "ANNOTATION" case PRIVATEqualified => "PRIVATEqualified" case PROTECTEDqualified => "PROTECTEDqualified" } diff --git a/src/dotty/tools/dotc/core/pickling/TreePickler.scala b/src/dotty/tools/dotc/core/pickling/TreePickler.scala index 801d3edb6..b842a5985 100644 --- a/src/dotty/tools/dotc/core/pickling/TreePickler.scala +++ b/src/dotty/tools/dotc/core/pickling/TreePickler.scala @@ -6,7 +6,7 @@ package pickling import ast.Trees._ import PickleFormat._ import core._ -import Contexts._, Symbols._, Types._, Names._, Constants._, Decorators._ +import Contexts._, Symbols._, Types._, Names._, Constants._, Decorators._, Annotations._ import collection.mutable import TastyBuffer._ @@ -187,7 +187,7 @@ class TreePickler(pickler: TastyPickler, picklePositions: Boolean) { withLength { pickleType(tpe.lo, richTypes); pickleType(tpe.hi, richTypes) } case tpe: AnnotatedType => writeByte(ANNOTATED) - withLength { pickleTree(tpe.annot.tree); pickleType(tpe.tpe, richTypes) } + withLength { pickleAnnotation(tpe.annot); pickleType(tpe.tpe, richTypes) } case tpe: AndOrType => writeByte(if (tpe.isAnd) ANDtype else ORtype) withLength { pickleType(tpe.tp1, richTypes); pickleType(tpe.tp2, richTypes) } @@ -385,9 +385,6 @@ class TreePickler(pickler: TastyPickler, picklePositions: Boolean) { case PackageDef(pid, stats) => writeByte(PACKAGE) withLength { pickleType(pid.tpe); stats.foreach(pickleTree) } - case Annotated(annot, arg) => - writeByte(ANNOTATED) - withLength { pickleTree(annot); pickleTree(arg) } case EmptyTree => writeByte(EMPTYTREE) }} @@ -450,7 +447,12 @@ class TreePickler(pickler: TastyPickler, picklePositions: Boolean) { if (flags is Covariant) writeByte(COVARIANT) if (flags is Contravariant) writeByte(CONTRAVARIANT) } - sym.annotations.foreach(ann => pickleTree(ann.tree)) + sym.annotations.foreach(pickleAnnotation) + } + + def pickleAnnotation(ann: Annotation) = { + writeByte(ANNOTATION) + withLength { pickleType(ann.symbol.typeRef); pickleTree(ann.tree) } } pickleTree(tree) |