summaryrefslogtreecommitdiff
path: root/sources/scalac/symtab
diff options
context:
space:
mode:
Diffstat (limited to 'sources/scalac/symtab')
-rw-r--r--sources/scalac/symtab/Definitions.java11
-rw-r--r--sources/scalac/symtab/Symbol.java21
-rw-r--r--sources/scalac/symtab/SymbolTablePrinter.java6
-rw-r--r--sources/scalac/symtab/classfile/UnPickle.java8
4 files changed, 42 insertions, 4 deletions
diff --git a/sources/scalac/symtab/Definitions.java b/sources/scalac/symtab/Definitions.java
index 1cf278c6c0..ac4d38e261 100644
--- a/sources/scalac/symtab/Definitions.java
+++ b/sources/scalac/symtab/Definitions.java
@@ -54,6 +54,10 @@ public class Definitions {
*/
public final Symbol NULL;
+ /** the zero value (a default null for type variables with bound Any)
+ */
+ public final Symbol ZERO;
+
/** the scala.Any class
*/
public final Symbol ANY_CLASS;
@@ -232,6 +236,7 @@ public class Definitions {
// the scala.ANYVAL class
ANYVAL_CLASS = getClass(Names.scala_AnyVal);
+ ANYVAL_CLASS.initialize();
ANYVAL_CLASS.flags |= Modifiers.SEALED;
ANYVAL_TYPE = ANYVAL_CLASS.typeConstructor();
@@ -381,6 +386,12 @@ public class Definitions {
Position.NOPOS, Names.null_, ROOT_CLASS, 0);
NULL.setInfo(ALLREF_TYPE);
ROOT.members().enter(NULL);
+
+ // add a null value to the root scope
+ ZERO = new TermSymbol(
+ Position.NOPOS, Names.ZERO, ROOT_CLASS, 0);
+ ZERO.setInfo(ALL_TYPE);
+ ROOT.members().enter(ZERO);
}
private Symbol newParameter(Symbol owner, Type tp) {
diff --git a/sources/scalac/symtab/Symbol.java b/sources/scalac/symtab/Symbol.java
index 28772e6bc5..d0494f1f83 100644
--- a/sources/scalac/symtab/Symbol.java
+++ b/sources/scalac/symtab/Symbol.java
@@ -3,7 +3,11 @@
** __\_ \/ /_/ / /__/ /_/ /\_ \ (c) 2002, LAMP/EPFL **
** /_____/\____/\___/\____/____/ **
**
+<<<<<<< Symbol.java
** $Id$
+=======
+** $Id$
+>>>>>>> 1.80
\* */
//todo check significance of JAVA flag.
@@ -508,6 +512,11 @@ public abstract class Symbol implements Modifiers, Kinds {
return owner().enclClass();
}
+ /** The next enclosing method */
+ public Symbol enclMethod() {
+ return isMethod() ? this : owner().enclMethod();
+ }
+
/** The top-level class enclosing `sym'
*/
Symbol enclToplevelClass() {
@@ -1008,7 +1017,7 @@ public abstract class Symbol implements Modifiers, Kinds {
*/
public Symbol overridingSymbol(Type sub) {
assert !isOverloaded() : this;
- Symbol sym1 = sub.lookupNonPrivate(name);
+ Symbol sym1 = sub.lookup(name);
if (sym1.kind == Kinds.NONE || (sym1.flags & STATIC) != 0) {
return Symbol.NONE;
} else {
@@ -1711,6 +1720,11 @@ public final class ErrorSymbol extends Symbol {
return this;
}
+ /** Return the next enclosing method */
+ public Symbol enclMethod() {
+ return this;
+ }
+
public Type loBound() {
return Type.ErrorType;
}
@@ -1759,6 +1773,11 @@ public final class NoSymbol extends Symbol {
return this;
}
+ /** Return the next enclosing method */
+ public Symbol enclMethod() {
+ return this;
+ }
+
public Symbol owner() {
throw new ApplicationError();
}
diff --git a/sources/scalac/symtab/SymbolTablePrinter.java b/sources/scalac/symtab/SymbolTablePrinter.java
index fdc40da179..3697e020bf 100644
--- a/sources/scalac/symtab/SymbolTablePrinter.java
+++ b/sources/scalac/symtab/SymbolTablePrinter.java
@@ -453,6 +453,8 @@ public class SymbolTablePrinter {
print('(');
for (int i = 0; i < vparams.length; i++) {
if (i > 0) print(",");
+ if ((vparams[i].flags & Modifiers.DEF) != 0)
+ print("def ");
printSymbolType(vparams[i], null);
}
print(')');
@@ -522,7 +524,9 @@ public class SymbolTablePrinter {
if (sym.isRoot()) return print("<root>");
return printPrefix(pre).printSymbolName(sym);
case CompoundType(Type[] parts, Scope members):
- return printTypes(parts," with ").space().printScope(members,true);
+ return printTypes(parts," with ").space()
+ .printScope(members,true)
+ .printSymbolUniqueId(type.symbol());
case MethodType(_, _):
return printType0(type, null);
case PolyType(_, _):
diff --git a/sources/scalac/symtab/classfile/UnPickle.java b/sources/scalac/symtab/classfile/UnPickle.java
index f5b4f7ab4f..ed3dd1bac8 100644
--- a/sources/scalac/symtab/classfile/UnPickle.java
+++ b/sources/scalac/symtab/classfile/UnPickle.java
@@ -46,10 +46,13 @@ public class UnPickle implements Kinds, Modifiers, EntryTags {
this.moduleroot = root;
this.classroot = root.owner().lookup(root.name.toTypeName());
}
+ if (root != moduleroot && moduleroot.isModule()) {
+ moduleroot.moduleClass().setInfo(Type.NoType);
+ }
if (global.debug)
global.log(
"unpickle " + root + " " + classroot + " " + moduleroot + " " +
- moduleroot.moduleClass() + moduleroot.moduleClass().primaryConstructor());
+ moduleroot.moduleClass() + " " + moduleroot.moduleClass().primaryConstructor());
this.bytes = data;
this.bp = 0;
this.sourceName = sourceName;
@@ -69,8 +72,9 @@ public class UnPickle implements Kinds, Modifiers, EntryTags {
if (global.debug) global.log("unpickled " + root + ":" + root.rawInfo());//debug
if (!root.isInitialized())
throw new BadSignature(this, "it does not define " + root);
- if (moduleroot.isModule() && !moduleroot.moduleClass().isInitialized())
+ if (moduleroot.isModule() && moduleroot.moduleClass().type() == Type.NoType) {
moduleroot.setInfo(Type.NoType);
+ }
}
Type setOwner(Type tp, Symbol owner) {