From a068498201e7223f35e8801055645bd5b339ce67 Mon Sep 17 00:00:00 2001 From: Dmitry Petrashko Date: Tue, 8 Mar 2016 14:14:00 +0100 Subject: Replace addAnnotation(annotation) by addAnnotation(Annotation(annotation)) as asked in https://github.com/lampepfl/dotty/pull/1155/files#r55355664 --- src/dotty/tools/dotc/core/Annotations.scala | 3 +++ src/dotty/tools/dotc/core/SymDenotations.scala | 4 ---- src/dotty/tools/dotc/transform/LazyVals.scala | 7 ++++--- 3 files changed, 7 insertions(+), 7 deletions(-) (limited to 'src') diff --git a/src/dotty/tools/dotc/core/Annotations.scala b/src/dotty/tools/dotc/core/Annotations.scala index b9c0eca43..2b27b5e01 100644 --- a/src/dotty/tools/dotc/core/Annotations.scala +++ b/src/dotty/tools/dotc/core/Annotations.scala @@ -47,6 +47,9 @@ object Annotations { def apply(tree: Tree) = ConcreteAnnotation(tree) + def apply(cls: ClassSymbol)(implicit ctx: Context): Annotation = + apply(cls, Nil) + def apply(cls: ClassSymbol, arg: Tree)(implicit ctx: Context): Annotation = apply(cls, arg :: Nil) diff --git a/src/dotty/tools/dotc/core/SymDenotations.scala b/src/dotty/tools/dotc/core/SymDenotations.scala index cc36ddcfa..bde8cc10a 100644 --- a/src/dotty/tools/dotc/core/SymDenotations.scala +++ b/src/dotty/tools/dotc/core/SymDenotations.scala @@ -285,10 +285,6 @@ object SymDenotations { final def addAnnotation(annot: Annotation): Unit = annotations = annot :: myAnnotations - /** Add given annotation to the annotations of this denotation */ - final def addAnnotation(annot: ClassSymbol)(implicit ctx: Context): Unit = - addAnnotation(ConcreteAnnotation(tpd.ref(annot))) - /** Remove annotation with given class from this denotation */ final def removeAnnotation(cls: Symbol)(implicit ctx: Context): Unit = annotations = myAnnotations.filterNot(_ matches cls) diff --git a/src/dotty/tools/dotc/transform/LazyVals.scala b/src/dotty/tools/dotc/transform/LazyVals.scala index 694cb2b0e..25b9afa68 100644 --- a/src/dotty/tools/dotc/transform/LazyVals.scala +++ b/src/dotty/tools/dotc/transform/LazyVals.scala @@ -1,6 +1,7 @@ package dotty.tools.dotc package transform +import dotty.tools.dotc.core.Annotations.Annotation import dotty.tools.dotc.core.Phases.NeedsCompanions import dotty.tools.dotc.typer.Mode @@ -91,7 +92,7 @@ class LazyVals extends MiniPhaseTransform with IdentityDenotTransformer with Nee appendOffsetDefs.get(cls) match { case None => template case Some(data) => - data.defs.foreach(_.symbol.addAnnotation(defn.ScalaStaticAnnot)) + data.defs.foreach(_.symbol.addAnnotation(Annotation(defn.ScalaStaticAnnot))) cpy.Template(template)(body = addInFront(data.defs, template.body)) } @@ -358,7 +359,7 @@ class LazyVals extends MiniPhaseTransform with IdentityDenotTransformer with Nee .symbol.asTerm } else { // need to create a new flag offsetSymbol = ctx.newSymbol(companion.moduleClass, (StdNames.nme.LAZY_FIELD_OFFSET + id.toString).toTermName, Flags.Synthetic, defn.LongType).enteredAfter(this) - offsetSymbol.addAnnotation(defn.ScalaStaticAnnot) + offsetSymbol.addAnnotation(Annotation(defn.ScalaStaticAnnot)) val flagName = (StdNames.nme.BITMAP_PREFIX + id.toString).toTermName val flagSymbol = ctx.newSymbol(claz, flagName, containerFlags, defn.LongType).enteredAfter(this) flag = ValDef(flagSymbol, Literal(Constants.Constant(0L))) @@ -368,7 +369,7 @@ class LazyVals extends MiniPhaseTransform with IdentityDenotTransformer with Nee case None => offsetSymbol = ctx.newSymbol(companion.moduleClass, (StdNames.nme.LAZY_FIELD_OFFSET + "0").toTermName, Flags.Synthetic, defn.LongType).enteredAfter(this) - offsetSymbol.addAnnotation(defn.ScalaStaticAnnot) + offsetSymbol.addAnnotation(Annotation(defn.ScalaStaticAnnot)) val flagName = (StdNames.nme.BITMAP_PREFIX + "0").toTermName val flagSymbol = ctx.newSymbol(claz, flagName, containerFlags, defn.LongType).enteredAfter(this) flag = ValDef(flagSymbol, Literal(Constants.Constant(0L))) -- cgit v1.2.3