summaryrefslogtreecommitdiff
path: root/sources/scalac/symtab/Symbol.java
diff options
context:
space:
mode:
authorpaltherr <paltherr@epfl.ch>2004-02-27 22:28:05 +0000
committerpaltherr <paltherr@epfl.ch>2004-02-27 22:28:05 +0000
commit0b75ded56f99a77dc19892fe8c3ceda16e72148e (patch)
treeb687d8358393eceecd7d6f69bd2dbb211872664b /sources/scalac/symtab/Symbol.java
parenta28376d5bd318446f3efc6534b9f54ef2336cd12 (diff)
downloadscala-0b75ded56f99a77dc19892fe8c3ceda16e72148e.tar.gz
scala-0b75ded56f99a77dc19892fe8c3ceda16e72148e.tar.bz2
scala-0b75ded56f99a77dc19892fe8c3ceda16e72148e.zip
- Removed mangled names from symbols
Diffstat (limited to 'sources/scalac/symtab/Symbol.java')
-rw-r--r--sources/scalac/symtab/Symbol.java86
1 files changed, 9 insertions, 77 deletions
diff --git a/sources/scalac/symtab/Symbol.java b/sources/scalac/symtab/Symbol.java
index a49b13a3a8..2eb9d4d78c 100644
--- a/sources/scalac/symtab/Symbol.java
+++ b/sources/scalac/symtab/Symbol.java
@@ -39,6 +39,9 @@ public abstract class Symbol implements Modifiers, Kinds {
// Fields -------------------------------------------------------------
+ /** The unique identifier generator */
+ private static int ids;
+
/** The kind of the symbol */
public int kind;
@@ -60,6 +63,10 @@ public abstract class Symbol implements Modifiers, Kinds {
/** The attributes of the symbol */
private final int attrs;
+ /** The unique identifier */
+ public final int id;
+
+
// Constructors -----------------------------------------------------------
/** Generic symbol constructor */
@@ -70,6 +77,7 @@ public abstract class Symbol implements Modifiers, Kinds {
this.owner = owner == null ? this : owner;
this.flags = flags & ~(INITIALIZED | LOCKED); // safety first
this.attrs = attrs;
+ this.id = ids++;
}
protected void update(int pos, int flags) {
@@ -145,11 +153,6 @@ public abstract class Symbol implements Modifiers, Kinds {
// Setters ---------------------------------------------------------------
- /** Set the mangled name of this Symbol */
- public Symbol setMangledName(Name name) {
- throw new ApplicationError("illegal operation on " + getClass());
- }
-
/** Set owner */
public Symbol setOwner(Symbol owner) {
assert !isConstructor() && !isNone() && !isError(): Debug.show(this);
@@ -583,18 +586,6 @@ public abstract class Symbol implements Modifiers, Kinds {
return simpleName();
}
- /** Get the mangled name of this Symbol
- * (this is always a normal name, never a type name)
- */
- public Name mangledName() {
- return isConstructor() ? constructorClass().name.toTermName() : name.toTermName();
- }
-
- /** Get the fully qualified mangled name of this Symbol */
- public Name mangledFullName() {
- return fullName().replace((byte)'.', (byte)'$');
- }
-
// Acess to related symbols -----------------------------------------------------
/** Get type parameters */
@@ -1037,25 +1028,7 @@ public abstract class Symbol implements Modifiers, Kinds {
} else if (that.isType()) {
return false;
}
-
- diff = that.mangledName().index - this.mangledName().index;
- if (diff > 0) return true;
- if (diff < 0) return false;
-
- diff = that.mangledFullName().index - this.mangledFullName().index;
- if (diff > 0) return true;
- if (diff < 0) return false;
-
- diff = that.hashCode() - this.hashCode();
- if (diff > 0) return true;
- if (diff < 0) return false;
-
- if (owner().isLess(that.owner())) return true;
- if (that.owner().isLess(owner())) return false;
-
- throw new ApplicationError(
- "Giving up: can't order two incarnations of class " +
- this.mangledFullName());
+ return this.id < that.id;
}
/** Return the symbol's type itself followed by all its direct and indirect
@@ -1692,9 +1665,6 @@ public class AbsTypeSymbol extends TypeSymbol {
*/
public class ClassSymbol extends TypeSymbol {
- /** The mangled class name */
- private Name mangled;
-
/** The module belonging to the class. This means:
* For Java classes, its statics parts.
* For module classes, the corresponding module.
@@ -1721,7 +1691,6 @@ public class ClassSymbol extends TypeSymbol {
}
public ClassSymbol(int pos, Name name, Symbol owner, int flags, int attrs) {
super(CLASS, pos, name, owner, flags, attrs);
- this.mangled = name;
this.rebindSym = new AliasTypeSymbol(pos, Names.ALIAS(this), owner, 0);
Type rebindType = new ClassAliasLazyType();
this.rebindSym.setInfo(rebindType);
@@ -1778,7 +1747,6 @@ public class ClassSymbol extends TypeSymbol {
other.module = module;
other.setInfo(info());
copyConstructorInfo(other);
- other.mangled = mangled;
if (thisSym != this) other.setTypeOfThis(typeOfThis());
return other;
}
@@ -1799,12 +1767,6 @@ public class ClassSymbol extends TypeSymbol {
*/
void setModule(Symbol module) { this.module = module; }
- /** Set the mangled name of this Symbol */
- public Symbol setMangledName(Name name) {
- this.mangled = name;
- return this;
- }
-
/** Get the fully qualified name of this Symbol */
public Name fullName() {
if (owner().kind == CLASS && !owner().isRoot())
@@ -1813,26 +1775,6 @@ public class ClassSymbol extends TypeSymbol {
return name.toTermName();
}
- /** Get the mangled name of this Symbol */
- public Name mangledName() {
- return mangled;
- }
-
- /** Get the fully qualified mangled name of this Symbol */
- public Name mangledFullName() {
- if (mangled == name) {
- return fullName().replace((byte)'.', (byte)'$');
- } else {
- Symbol tc = enclToplevelClass();
- if (tc != this) {
- return Name.fromString(
- enclToplevelClass().mangledFullName() + "$" + mangled);
- } else {
- return mangled;
- }
- }
- }
-
public Type thisType() {
return thistp;
}
@@ -1903,11 +1845,6 @@ public final class ErrorSymbol extends Symbol {
return this;
}
- /** Set the mangled name of this Symbol */
- public Symbol mangled(Name name) {
- return this;
- }
-
/** Set type */
public Symbol setInfo(Type info) {
assert info == Type.ErrorType : info;
@@ -1954,11 +1891,6 @@ public final class NoSymbol extends Symbol {
return this;
}
- /** Set the mangled name of this Symbol */
- public Symbol mangled(Name name) {
- throw new ApplicationError("illegal operation on " + getClass());
- }
-
/** Set type */
public Symbol setInfo(Type info) {
assert info == Type.NoType : info;