diff options
author | Lukas Rytz <lukas.rytz@epfl.ch> | 2009-06-10 15:27:45 +0000 |
---|---|---|
committer | Lukas Rytz <lukas.rytz@epfl.ch> | 2009-06-10 15:27:45 +0000 |
commit | 771451984aa25e8f81faac0f58d9001f68928713 (patch) | |
tree | bcad313c0f3a4af199e93c3008fc8196cb8c9511 /src | |
parent | 1164ab879a679085662db70a1f6ecdf035a196ef (diff) | |
download | scala-771451984aa25e8f81faac0f58d9001f68928713.tar.gz scala-771451984aa25e8f81faac0f58d9001f68928713.tar.bz2 scala-771451984aa25e8f81faac0f58d9001f68928713.zip |
minor annotations cleanup
Diffstat (limited to 'src')
-rw-r--r-- | src/compiler/scala/tools/nsc/symtab/AnnotationInfos.scala | 17 | ||||
-rw-r--r-- | src/compiler/scala/tools/nsc/typechecker/Namers.scala | 5 |
2 files changed, 9 insertions, 13 deletions
diff --git a/src/compiler/scala/tools/nsc/symtab/AnnotationInfos.scala b/src/compiler/scala/tools/nsc/symtab/AnnotationInfos.scala index 0aa228062e..2b89f295d4 100644 --- a/src/compiler/scala/tools/nsc/symtab/AnnotationInfos.scala +++ b/src/compiler/scala/tools/nsc/symtab/AnnotationInfos.scala @@ -33,23 +33,14 @@ trait AnnotationInfos { * converted into a compile-time Constant. Used to pickle Literals * as Constants */ - val constant = { - def lit2cons(t: Tree): Option[Constant] = t match { - case Literal(c) => Some(c) - // case Typed(t, _) => lit2cons(t) - // disabling this: in the expression "3: @ann", the annotation gets lost. - case _ => None - } - lit2cons(intTree) + val constant = intTree match { + case Literal(c) => Some(c) + case _ => None } def isConstant = !constant.isEmpty - override def toString: String = - constant match { - case Some(cons) => cons.escapedStringValue - case None => intTree.toString - } + override def toString = intTree.toString } /** Subclasses of this class are used to represent Arguments diff --git a/src/compiler/scala/tools/nsc/typechecker/Namers.scala b/src/compiler/scala/tools/nsc/typechecker/Namers.scala index 477c69cad2..626dbe00bd 100644 --- a/src/compiler/scala/tools/nsc/typechecker/Namers.scala +++ b/src/compiler/scala/tools/nsc/typechecker/Namers.scala @@ -1054,6 +1054,11 @@ trait Namers { self: Analyzer => val sym: Symbol = tree.symbol // For definitions, transform Annotation trees to AnnotationInfos, assign // them to the sym's annotations. Type annotations: see Typer.typedAnnotated + + // We have to parse definition annotatinos here (not in the typer when traversing + // the MemberDef tree): the typer looks at annotations of certain symbols; if + // they were added only in typer, depending on the compilation order, they would + // be visible or not val annotated = if (sym.isModule) sym.moduleClass else sym if (annotated.annotations.isEmpty) tree match { case defn: MemberDef => |