diff options
author | Lukas Rytz <lukas.rytz@epfl.ch> | 2012-07-02 17:25:18 +0200 |
---|---|---|
committer | Lukas Rytz <lukas.rytz@epfl.ch> | 2012-07-05 14:36:44 +0200 |
commit | 70503355299263f95a3447701bb483375bf46665 (patch) | |
tree | 70439d6bca065cc9b28c5f681e86bef3e7a6f9ad /src/reflect/scala/reflect/internal/Symbols.scala | |
parent | 4b6ae392a7aaf147de3991998d52be5e7b7e665e (diff) | |
download | scala-70503355299263f95a3447701bb483375bf46665.tar.gz scala-70503355299263f95a3447701bb483375bf46665.tar.bz2 scala-70503355299263f95a3447701bb483375bf46665.zip |
Allow attachments for symbols, just like for trees.
Removes the two global hash maps in Namers, and the one in NamesDefaults. Also fixes SI-5975.
Diffstat (limited to 'src/reflect/scala/reflect/internal/Symbols.scala')
-rw-r--r-- | src/reflect/scala/reflect/internal/Symbols.scala | 9 |
1 files changed, 5 insertions, 4 deletions
diff --git a/src/reflect/scala/reflect/internal/Symbols.scala b/src/reflect/scala/reflect/internal/Symbols.scala index 79041924a8..f0c6252dd9 100644 --- a/src/reflect/scala/reflect/internal/Symbols.scala +++ b/src/reflect/scala/reflect/internal/Symbols.scala @@ -10,6 +10,7 @@ import scala.collection.{ mutable, immutable } import scala.collection.mutable.ListBuffer import util.Statistics import Flags._ +import base.Attachments trait Symbols extends api.Symbols { self: SymbolTable => import definitions._ @@ -154,7 +155,8 @@ trait Symbols extends api.Symbols { self: SymbolTable => abstract class Symbol protected[Symbols] (initOwner: Symbol, initPos: Position, initName: Name) extends SymbolContextApiImpl with HasFlags - with Annotatable[Symbol] { + with Annotatable[Symbol] + with Attachable { type AccessBoundaryType = Symbol type AnnotationType = AnnotationInfo @@ -176,7 +178,7 @@ trait Symbols extends api.Symbols { self: SymbolTable => def rawowner = _rawowner def rawflags = _rawflags - private var rawpos = initPos + rawatt = initPos val id = nextId() // identity displayed when -uniqid //assert(id != 3390, initName) @@ -189,8 +191,6 @@ trait Symbols extends api.Symbols { self: SymbolTable => def validTo = _validTo def validTo_=(x: Period) { _validTo = x} - def pos = rawpos - def setPos(pos: Position): this.type = { this.rawpos = pos; this } def setName(name: Name): this.type = { this.name = asNameType(name) ; this } // Update the surrounding scopes @@ -1616,6 +1616,7 @@ trait Symbols extends api.Symbols { self: SymbolTable => setInfo (this.info cloneInfo clone) setAnnotations this.annotations ) + this.attachments.all.foreach(clone.addAttachment) if (clone.thisSym != clone) clone.typeOfThis = (clone.typeOfThis cloneInfo clone) |