diff options
author | Martin Odersky <odersky@gmail.com> | 2011-12-01 11:28:42 +0100 |
---|---|---|
committer | Martin Odersky <odersky@gmail.com> | 2011-12-01 11:28:42 +0100 |
commit | eb5e621d5130ceedfe0b88c2b5580438aaf98a4d (patch) | |
tree | 8d25ac7ad3029a9f7caa6e65fc31a8bbf2fec485 /src | |
parent | 51f5831b0c0d14c28938a6f537b93f183217d942 (diff) | |
download | scala-eb5e621d5130ceedfe0b88c2b5580438aaf98a4d.tar.gz scala-eb5e621d5130ceedfe0b88c2b5580438aaf98a4d.tar.bz2 scala-eb5e621d5130ceedfe0b88c2b5580438aaf98a4d.zip |
Fix to position in AnnotationInfo
Lazy annotation now return positions and one can also set them. Fixes a problem reported by Greg (no ticket created).
Diffstat (limited to 'src')
-rw-r--r-- | src/compiler/scala/reflect/internal/AnnotationInfos.scala | 9 |
1 files changed, 8 insertions, 1 deletions
diff --git a/src/compiler/scala/reflect/internal/AnnotationInfos.scala b/src/compiler/scala/reflect/internal/AnnotationInfos.scala index 22c56642a7..762921f553 100644 --- a/src/compiler/scala/reflect/internal/AnnotationInfos.scala +++ b/src/compiler/scala/reflect/internal/AnnotationInfos.scala @@ -128,7 +128,12 @@ trait AnnotationInfos extends api.AnnotationInfos { self: SymbolTable => */ final class LazyAnnotationInfo(lazyInfo: => AnnotationInfo) extends AnnotationInfo { private var forced = false - private lazy val forcedInfo = try lazyInfo finally forced = true + private lazy val forcedInfo = + try { + val result = lazyInfo + if (result.pos == NoPosition) result setPos pos + result + } finally forced = true def atp: Type = forcedInfo.atp def args: List[Tree] = forcedInfo.args @@ -136,6 +141,8 @@ trait AnnotationInfos extends api.AnnotationInfos { self: SymbolTable => // We should always be able to print things without forcing them. override def toString = if (forced) forcedInfo.toString else "@<?>" + + override def pos: Position = forcedInfo.pos } /** Typed information about an annotation. It can be attached to either |