diff options
author | paltherr <paltherr@epfl.ch> | 2003-05-05 08:45:59 +0000 |
---|---|---|
committer | paltherr <paltherr@epfl.ch> | 2003-05-05 08:45:59 +0000 |
commit | 42fe3b7da729cc65595d25aa7da5df3538c5d4e8 (patch) | |
tree | baf2d4937cac96a400291f623bc90517e3cbac06 /sources/scalac/symtab/Symbol.java | |
parent | 7871c81399507b57073a31f85b92b9d58a6caee6 (diff) | |
download | scala-42fe3b7da729cc65595d25aa7da5df3538c5d4e8.tar.gz scala-42fe3b7da729cc65595d25aa7da5df3538c5d4e8.tar.bz2 scala-42fe3b7da729cc65595d25aa7da5df3538c5d4e8.zip |
- Changed setOwner to automatically update the ...
- Changed setOwner to automatically update the owner of the associated
class (for modules) and constructor (for classes).
Diffstat (limited to 'sources/scalac/symtab/Symbol.java')
-rw-r--r-- | sources/scalac/symtab/Symbol.java | 16 |
1 files changed, 13 insertions, 3 deletions
diff --git a/sources/scalac/symtab/Symbol.java b/sources/scalac/symtab/Symbol.java index f0578b8cee..53a77fb2bf 100644 --- a/sources/scalac/symtab/Symbol.java +++ b/sources/scalac/symtab/Symbol.java @@ -95,9 +95,19 @@ public abstract class Symbol implements Modifiers, Kinds { /** Set owner */ public Symbol setOwner(Symbol owner) { - this.owner = owner; + assert !isModuleClass() : Debug.show(this); + assert !isPrimaryConstructor() : Debug.show(this); + setOwner(this, owner); return this; } + private static void setOwner(Symbol symbol, Symbol owner) { + assert symbol != null; + assert symbol != Symbol.NONE; + assert symbol != Symbol.ERROR; + if (symbol.isModule()) setOwner(symbol.moduleClass(), owner); + if (symbol.isClass()) setOwner(symbol.constructor(), owner); + symbol.owner = owner; + } /** Set information, except if symbol is both initialized and locked. */ @@ -1237,7 +1247,7 @@ public class ClassSymbol extends TypeSymbol { */ public ClassSymbol(int pos, Name name, Symbol owner, int flags) { super(CLASS, pos, name, owner, flags); - this.constructor = TermSymbol.newConstructor(this, flags); + this.constructor = TermSymbol.newConstructor(this, flags & ~MODUL); this.mangled = name; } @@ -1261,7 +1271,7 @@ public class ClassSymbol extends TypeSymbol { */ public ClassSymbol(Name name, Symbol owner, ClassParser parser) { super(CLASS, Position.NOPOS, name, owner, JAVA); - this.constructor = TermSymbol.newConstructor(this, flags); + this.constructor = TermSymbol.newConstructor(this, flags & ~MODUL); this.module = TermSymbol.newCompanionModule(this, JAVA, parser.staticsParser(this)); this.mangled = name; this.setInfo(parser); |