diff options
author | paltherr <paltherr@epfl.ch> | 2005-02-01 13:36:43 +0000 |
---|---|---|
committer | paltherr <paltherr@epfl.ch> | 2005-02-01 13:36:43 +0000 |
commit | 0f88183f98998ccff74003ea5c373ad0401edb10 (patch) | |
tree | e55ad7df0d9879e7db6f86915e2586c8c4f7b4c2 /sources/scalac/symtab/Symbol.java | |
parent | 93f05e44fd8a409a98f496f5a857588ffa90fdf8 (diff) | |
download | scala-0f88183f98998ccff74003ea5c373ad0401edb10.tar.gz scala-0f88183f98998ccff74003ea5c373ad0401edb10.tar.bz2 scala-0f88183f98998ccff74003ea5c373ad0401edb10.zip |
- Added method getOrigin and setOrigin
Diffstat (limited to 'sources/scalac/symtab/Symbol.java')
-rw-r--r-- | sources/scalac/symtab/Symbol.java | 36 |
1 files changed, 36 insertions, 0 deletions
diff --git a/sources/scalac/symtab/Symbol.java b/sources/scalac/symtab/Symbol.java index 6a50761c02..b7d228d001 100644 --- a/sources/scalac/symtab/Symbol.java +++ b/sources/scalac/symtab/Symbol.java @@ -868,6 +868,24 @@ public abstract class Symbol implements Modifiers, Kinds { return name; } +// Symbol origin -------------------------------------------------------------- + + /** Returns the origin of this symbol. */ + public SymbolOrigin getOrigin() { + if (isModule()) + return moduleClass().getOrigin(); + if (isConstructor()) + return constructorClass().getOrigin(); + if (isCaseFactory()) + return type().resultType().symbol().getOrigin(); + return owner().getOrigin(); + } + + /** Sets the origin of this symbol. */ + public void setOrigin(SymbolOrigin origin) { + throw Debug.abort("not a class", this); + } + // Acess to related symbols ----------------------------------------------------- /** Get type parameters */ @@ -2079,6 +2097,9 @@ final class AbsTypeSymbol extends TypeSymbol { /** A class for class symbols. */ public class ClassSymbol extends TypeSymbol { + /** The origin of this symbol */ + private SymbolOrigin origin; + /** The given type of self, or NoType, if no explicit type was given. */ private Symbol thisSym = this; @@ -2135,6 +2156,16 @@ public class ClassSymbol extends TypeSymbol { return newTerm(pos, SYNTHETIC, Names.this_, IS_THISTYPE); } + /** Returns the origin of this symbol. */ + public SymbolOrigin getOrigin() { + return origin != null ? origin : super.getOrigin(); + } + + /** Sets the origin of this symbol. */ + public void setOrigin(SymbolOrigin origin) { + this.origin = origin; + } + public Type thisType() { Global global = Global.instance; if (global.currentPhase.id > global.PHASE.ERASURE.id()) return type(); @@ -2316,6 +2347,11 @@ final class NoSymbol extends Symbol { super.setInfo(Type.NoType); } + /** Returns the origin of this symbol. */ + public SymbolOrigin getOrigin() { + return SymbolOrigin.Unknown; + } + /** Set type */ public Symbol setInfo(Type info) { assert info == Type.NoType : info; |