summaryrefslogtreecommitdiff
path: root/src/reflect/scala/reflect/internal/Symbols.scala
diff options
context:
space:
mode:
authorPaul Phillips <paulp@improving.org>2013-03-05 10:09:34 -0800
committerAdriaan Moors <adriaan.moors@typesafe.com>2013-03-09 11:03:11 -0800
commit9094822181c398b945b7f30ac1e2b05da9796f53 (patch)
treea3e5f0c7d2b821ce5d841dccd4007e4dca51a09b /src/reflect/scala/reflect/internal/Symbols.scala
parent960f9848897f2511a08d2a5908078a348dfb1716 (diff)
downloadscala-9094822181c398b945b7f30ac1e2b05da9796f53.tar.gz
scala-9094822181c398b945b7f30ac1e2b05da9796f53.tar.bz2
scala-9094822181c398b945b7f30ac1e2b05da9796f53.zip
Enabling commit for interactive/scaladoc modules.
This is a non-behaviorally-changing setup commit which re-routes bits of code through avenues which can more easily be influenced by subclasses of Global.
Diffstat (limited to 'src/reflect/scala/reflect/internal/Symbols.scala')
-rw-r--r--src/reflect/scala/reflect/internal/Symbols.scala22
1 files changed, 15 insertions, 7 deletions
diff --git a/src/reflect/scala/reflect/internal/Symbols.scala b/src/reflect/scala/reflect/internal/Symbols.scala
index 26ca62c44a..f7a87d2700 100644
--- a/src/reflect/scala/reflect/internal/Symbols.scala
+++ b/src/reflect/scala/reflect/internal/Symbols.scala
@@ -69,6 +69,20 @@ trait Symbols extends api.Symbols { self: SymbolTable =>
*/
val originalOwner = perRunCaches.newMap[Symbol, Symbol]()
+ // TODO - don't allow the owner to be changed without checking invariants, at least
+ // when under some flag. Define per-phase invariants for owner/owned relationships,
+ // e.g. after flatten all classes are owned by package classes, there are lots and
+ // lots of these to be declared (or more realistically, discovered.)
+ protected def saveOriginalOwner(sym: Symbol) {
+ // don't keep the original owner in presentation compiler runs
+ // (the map will grow indefinitely, and the only use case is the
+ // backend).
+ if (!forInteractive) {
+ if (originalOwner contains sym) ()
+ else originalOwner(sym) = sym.rawowner
+ }
+ }
+
abstract class SymbolContextApiImpl extends SymbolContextApi {
this: Symbol =>
@@ -948,13 +962,7 @@ trait Symbols extends api.Symbols { self: SymbolTable =>
// e.g. after flatten all classes are owned by package classes, there are lots and
// lots of these to be declared (or more realistically, discovered.)
def owner_=(owner: Symbol) {
- // don't keep the original owner in presentation compiler runs
- // (the map will grow indefinitely, and the only use case is the
- // backend).
- if (!forInteractive) {
- if (originalOwner contains this) ()
- else originalOwner(this) = rawowner
- }
+ saveOriginalOwner(this)
assert(isCompilerUniverse, "owner_= is not thread-safe; cannot be run in reflexive code")
if (traceSymbolActivity)
traceSymbols.recordNewSymbolOwner(this, owner)