summaryrefslogtreecommitdiff
path: root/sources/scalac/symtab/Symbol.java
diff options
context:
space:
mode:
Diffstat (limited to 'sources/scalac/symtab/Symbol.java')
-rw-r--r--sources/scalac/symtab/Symbol.java33
1 files changed, 25 insertions, 8 deletions
diff --git a/sources/scalac/symtab/Symbol.java b/sources/scalac/symtab/Symbol.java
index f6466931d7..980e11fd01 100644
--- a/sources/scalac/symtab/Symbol.java
+++ b/sources/scalac/symtab/Symbol.java
@@ -56,7 +56,7 @@ 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;
+ static public int FIRST_ID = Global.POST_ANALYZER_PHASE_ID;
// Constructors -----------------------------------------------------------
@@ -168,6 +168,10 @@ public abstract class Symbol implements Modifiers, Kinds {
// Symbol classification ----------------------------------------------------
+ public final boolean isDefined() {
+ return !(rawInfoAt(FIRST_ID) instanceof Type.LazyType);
+ }
+
/** Does this symbol denote a type? */
public final boolean isType() {
return kind == TYPE || kind == CLASS || kind == ALIAS;
@@ -961,17 +965,25 @@ public class TermSymbol extends Symbol {
return newConstructor(clazz, clazz.flags & (ACCESSFLAGS | JAVA));
}
- public static TermSymbol newModule(int pos, Name name, Symbol owner, int flags) {
+ public static TermSymbol newModule(int pos, Name name, Symbol owner,
+ int flags, ClassSymbol clazz) {
TermSymbol sym = new TermSymbol(pos, name, owner, flags | MODUL | FINAL);
- Symbol clazz = new ClassSymbol(
- pos, name.toTypeName(), owner, flags | MODUL | FINAL, sym);
- clazz.constructor().setInfo(
- Type.MethodType(Symbol.EMPTY_ARRAY, clazz.typeConstructor()));
sym.clazz = clazz;
+ clazz.setModule(sym);
sym.setInfo(clazz.typeConstructor());
return sym;
}
+ public static TermSymbol newModule(int pos, Name name, Symbol owner,
+ int flags) {
+ ClassSymbol clazz = new ClassSymbol(
+ pos, name.toTypeName(), owner, flags | MODUL | FINAL);
+ clazz.constructor().setInfo(
+ Type.MethodType(Symbol.EMPTY_ARRAY, clazz.typeConstructor()));
+
+ return newModule(pos, name, owner, flags, clazz);
+ }
+
/** Constructor for companion modules to classes, which need to be completed.
*/
public static TermSymbol newCompanionModule(Symbol clazz, int flags, Type.LazyType parser) {
@@ -1257,11 +1269,11 @@ public class ClassSymbol extends TypeSymbol {
}
/** Constructor for module classes and classes with static members.
- */
public ClassSymbol(int pos, Name name, Symbol owner, int flags, Symbol module) {
this(pos, name, owner, flags);
this.module = module;
}
+ */
/** Constructor for classes to load as source files
*/
@@ -1282,7 +1294,8 @@ public class ClassSymbol extends TypeSymbol {
/** Return a fresh symbol with the same fields as this one.
*/
public Symbol cloneSymbol(Symbol owner) {
- ClassSymbol other = new ClassSymbol(pos, name, owner, flags, module);
+ ClassSymbol other = new ClassSymbol(pos, name, owner, flags);
+ other.module = module;
other.setInfo(info());
other.constructor.setInfo(
fixClonedConstrType(
@@ -1320,6 +1333,10 @@ public class ClassSymbol extends TypeSymbol {
return module;
}
+ /** Set module; only used internally from TermSymbol
+ */
+ void setModule(Symbol module) { this.module = module; }
+
/** Set the mangled name of this Symbol */
public Symbol setMangledName(Name name) {
this.mangled = name;