summaryrefslogtreecommitdiff
path: root/sources/scalac
diff options
context:
space:
mode:
authorMartin Odersky <odersky@gmail.com>2003-04-30 10:29:25 +0000
committerMartin Odersky <odersky@gmail.com>2003-04-30 10:29:25 +0000
commit81a8fae3a68f020355b7bfbc30c34d69508d1b03 (patch)
tree163945dbed5e09dabeb7a09687fbc15ce81a1c0a /sources/scalac
parent21f24de326d79515c44f80665f9679410389b1ab (diff)
downloadscala-81a8fae3a68f020355b7bfbc30c34d69508d1b03.tar.gz
scala-81a8fae3a68f020355b7bfbc30c34d69508d1b03.tar.bz2
scala-81a8fae3a68f020355b7bfbc30c34d69508d1b03.zip
*** empty log message ***
Diffstat (limited to 'sources/scalac')
-rw-r--r--sources/scalac/Global.java2
-rw-r--r--sources/scalac/symtab/Symbol.java26
-rw-r--r--sources/scalac/symtab/Type.java2
-rw-r--r--sources/scalac/symtab/classfile/ClassParser.java4
4 files changed, 20 insertions, 14 deletions
diff --git a/sources/scalac/Global.java b/sources/scalac/Global.java
index 606fb4f639..9ba64c6c47 100644
--- a/sources/scalac/Global.java
+++ b/sources/scalac/Global.java
@@ -104,7 +104,7 @@ public class Global {
public final PhaseDescriptor[] phases;
public static final int START_PHASE_ID = 1;
- public final int POST_ANALYZER_PHASE_ID = 3;
+ public static final int POST_ANALYZER_PHASE_ID = 3;
/** compilation targets
*/
diff --git a/sources/scalac/symtab/Symbol.java b/sources/scalac/symtab/Symbol.java
index eeb4d6e647..f0578b8cee 100644
--- a/sources/scalac/symtab/Symbol.java
+++ b/sources/scalac/symtab/Symbol.java
@@ -56,6 +56,8 @@ public abstract class Symbol implements Modifiers, Kinds {
/** The infos of the symbol */
private TypeIntervalList infos = TypeIntervalList.EMPTY;
+ static int FIRST_ID = Global.POST_ANALYZER_PHASE_ID;
+
// Constructors -----------------------------------------------------------
/** Generic symbol constructor */
@@ -113,8 +115,9 @@ public abstract class Symbol implements Modifiers, Kinds {
((Type.PolyType)info).result instanceof Type.MethodType
: "illegal type for " + this + ": " + info;
if ((flags & (INITIALIZED | LOCKED)) != (INITIALIZED | LOCKED)) {
- if (infos == TypeIntervalList.EMPTY)
+ if (infos == TypeIntervalList.EMPTY) {
infos = new TypeIntervalList(TypeIntervalList.EMPTY);
+ }
infos.limit = limit;
infos.info = info;
}
@@ -132,7 +135,6 @@ public abstract class Symbol implements Modifiers, Kinds {
}
public Symbol updateInfo(Type info) {
- // Global.instance.currentPhase.setInfo(this, info);
assert infos.limit <= Global.instance.currentPhase.id + 1 : this;
if (infos.limit > Global.instance.currentPhase.id) infos.limit--;
infos = new TypeIntervalList(infos);
@@ -474,9 +476,7 @@ public abstract class Symbol implements Modifiers, Kinds {
*/
int currentPhaseId() {
int id = Global.instance.currentPhase.id;
- if (id > Global.instance.POST_ANALYZER_PHASE_ID)
- id = Global.instance.POST_ANALYZER_PHASE_ID;
- return id;
+ return id < FIRST_ID ? FIRST_ID : id;
}
/** Is this symbol initialized? */
@@ -498,11 +498,10 @@ public abstract class Symbol implements Modifiers, Kinds {
* its baseclasses and members.
*/
public Type info() {
+ int id = currentPhaseId();
if ((flags & INITIALIZED) == 0) {
- int id = currentPhaseId();
- Type info = rawInfoAt(id);
+ Type info = rawInfoAt(FIRST_ID);
assert info != null : this;
-
if ((flags & LOCKED) != 0) {
setInfo(Type.ErrorType);
flags |= INITIALIZED;
@@ -522,7 +521,7 @@ public abstract class Symbol implements Modifiers, Kinds {
}
//System.out.println("done: " + this);//DEBUG
}
- return rawInfoAt(Global.instance.currentPhase.id);
+ return rawInfoAt(id);
}
/** Get info at phase #id
@@ -571,7 +570,7 @@ public abstract class Symbol implements Modifiers, Kinds {
}
public Type rawInfo() {
- return rawInfoAt(Global.instance.currentPhase.id);
+ return rawInfoAt(currentPhaseId());
}
/** The type of a symbol is:
@@ -895,6 +894,9 @@ public abstract class Symbol implements Modifiers, Kinds {
System.arraycopy(alttypes2, 0, alttypes3, alttypes1.length, alttypes2.length);
overloaded.setInfo(Type.OverloadedType(alts3, alttypes3));
}
+ public String toString() {
+ return "LazyOverloadedType(" + sym1 + "," + sym2 + ")";
+ }
}
/** All the alternatives of this symbol if it's overloaded, the
@@ -1082,9 +1084,9 @@ public class TypeSymbol extends Symbol {
public Type[] closure() {
if (kind == ALIAS) return info().symbol().closure();
- int id = Global.instance.currentPhase.id;
+ int id = currentPhaseId();
if (closures.limit < id) {
- if (id == Global.START_PHASE_ID || changes(closureAt(id - 1))) {
+ if (id == FIRST_ID || changes(closureAt(id - 1))) {
closures = new ClosureIntervalList(closures);
closures.limit = id;
computeClosure();
diff --git a/sources/scalac/symtab/Type.java b/sources/scalac/symtab/Type.java
index 80e0823f97..f61720c44d 100644
--- a/sources/scalac/symtab/Type.java
+++ b/sources/scalac/symtab/Type.java
@@ -704,7 +704,7 @@ public class Type implements Modifiers, Kinds, TypeTags {
if (elemtp1 == elemtp) return tp;
else return UnboxedArrayType(elemtp1);
default:
- throw new ApplicationError(tp);
+ throw new ApplicationError(tp + " " + tp.symbol());
}
}
diff --git a/sources/scalac/symtab/classfile/ClassParser.java b/sources/scalac/symtab/classfile/ClassParser.java
index 9948ba33cf..6f3a5605db 100644
--- a/sources/scalac/symtab/classfile/ClassParser.java
+++ b/sources/scalac/symtab/classfile/ClassParser.java
@@ -79,6 +79,10 @@ public class ClassParser extends Type.LazyType {
public void complete(Symbol statics) {
ClassParser.this.complete(clazz);
}
+
+ public String toString() {
+ return "StaticsParser(" + clazz + ")";
+ }
}
class AliasParser extends Type.LazyType {