summaryrefslogtreecommitdiff
path: root/sources/scalac
diff options
context:
space:
mode:
authorpaltherr <paltherr@epfl.ch>2004-03-09 22:15:58 +0000
committerpaltherr <paltherr@epfl.ch>2004-03-09 22:15:58 +0000
commit1e478c2c6e842e2f857f72ec8e25fcac7f694e59 (patch)
tree782ede821943c1371d59365e8bd8a162f059f02f /sources/scalac
parent8f6a248aced0a0c27131b509174301b63fb62017 (diff)
downloadscala-1e478c2c6e842e2f857f72ec8e25fcac7f694e59.tar.gz
scala-1e478c2c6e842e2f857f72ec8e25fcac7f694e59.tar.bz2
scala-1e478c2c6e842e2f857f72ec8e25fcac7f694e59.zip
- Removed unused method Symbol.enclToplevelClass
- Added method Symbol.isPackageClass - Changed method Symbol.isPackage to return true only for terms
Diffstat (limited to 'sources/scalac')
-rw-r--r--sources/scalac/backend/msil/TypeCreator.java2
-rw-r--r--sources/scalac/symtab/Symbol.java18
-rw-r--r--sources/scalac/symtab/SymbolNameWriter.java2
-rw-r--r--sources/scalac/transformer/ExpandMixinsPhase.java3
-rw-r--r--sources/scalac/transformer/ExplicitOuterClassesPhase.java20
5 files changed, 18 insertions, 27 deletions
diff --git a/sources/scalac/backend/msil/TypeCreator.java b/sources/scalac/backend/msil/TypeCreator.java
index 312897810a..bc06a9111a 100644
--- a/sources/scalac/backend/msil/TypeCreator.java
+++ b/sources/scalac/backend/msil/TypeCreator.java
@@ -540,7 +540,7 @@ final class TypeCreator {
for (int i = 1; i < inum; i++)
interfaces[i - 1] = getType(baseTypes[i].symbol());
}
- if (owner.isRoot() || owner.isPackage()) { // i.e. top level class
+ if (owner.isRoot() || owner.isPackageClass()) { // i.e. top level class
type = module.DefineType
(typeName, translateTypeAttributes(clazz.flags, false),
superType, interfaces);
diff --git a/sources/scalac/symtab/Symbol.java b/sources/scalac/symtab/Symbol.java
index d5785891d3..eacfdf0310 100644
--- a/sources/scalac/symtab/Symbol.java
+++ b/sources/scalac/symtab/Symbol.java
@@ -434,7 +434,12 @@ public abstract class Symbol implements Modifiers, Kinds {
/** Does this symbol denote a Java package? */
public final boolean isPackage() {
- return (flags & PACKAGE) != 0;
+ return kind == VAL && (flags & PACKAGE) != 0;
+ }
+
+ /** Does this symbol denote a Java package class? */
+ public final boolean isPackageClass() {
+ return kind == CLASS && (flags & PACKAGE) != 0;
}
/** Does this symbol denote a module? */
@@ -716,17 +721,6 @@ public abstract class Symbol implements Modifiers, Kinds {
return isMethod() ? this : owner().enclMethod();
}
- /** The top-level class enclosing `sym'
- */
- Symbol enclToplevelClass() {
- Symbol sym = this;
- while (sym.kind == VAL ||
- (sym.kind == CLASS && !sym.owner().isPackage())) {
- sym = sym.owner();
- }
- return sym;
- }
-
/** If this is a constructor, return the class it constructs.
* Otherwise return the symbol itself.
*/
diff --git a/sources/scalac/symtab/SymbolNameWriter.java b/sources/scalac/symtab/SymbolNameWriter.java
index 0a272664e8..2a9b5ccb04 100644
--- a/sources/scalac/symtab/SymbolNameWriter.java
+++ b/sources/scalac/symtab/SymbolNameWriter.java
@@ -223,7 +223,7 @@ public class SymbolNameWriter {
if (owner.isRoot()) return root;
if (owner.isNone()) return none;
if (owner.isError()) return error;
- if (owner.isPackage()) return peckage;
+ if (owner.isPackageClass()) return peckage;
if (owner.isClass()) return symbol.isClass() ? clasz : member;
return other;
}
diff --git a/sources/scalac/transformer/ExpandMixinsPhase.java b/sources/scalac/transformer/ExpandMixinsPhase.java
index 68796b5996..07e514fcfc 100644
--- a/sources/scalac/transformer/ExpandMixinsPhase.java
+++ b/sources/scalac/transformer/ExpandMixinsPhase.java
@@ -100,14 +100,11 @@ public class ExpandMixinsPhase extends Phase {
/** Applies this phase to the given type for the given symbol. */
public Type transformInfo(Symbol symbol, Type type) {
- Symbol s = symbol;
while (true) {
if (symbol.isJava()) return type;
- if (symbol.isPackage()) return type;
if (symbol.isInterface()) return type;
if (symbol.isCompoundSym()) return type; // !!! check
if (symbol.isClass()) {
- // !!! System.out.println(Debug.show("!!! ", s, " -> ", symbol, " - ", getTypeExpander(symbol).clasz, " : " + type));
return getTypeExpander(symbol).apply(type);
}
symbol = symbol.isConstructor()
diff --git a/sources/scalac/transformer/ExplicitOuterClassesPhase.java b/sources/scalac/transformer/ExplicitOuterClassesPhase.java
index 5ddda74792..0b32029ef4 100644
--- a/sources/scalac/transformer/ExplicitOuterClassesPhase.java
+++ b/sources/scalac/transformer/ExplicitOuterClassesPhase.java
@@ -75,9 +75,9 @@ public class ExplicitOuterClassesPhase extends Phase {
/** Applies this phase to the given type for the given symbol. */
public Type transformInfo(Symbol symbol, Type type) {
- if (show && !symbol.isPackage()) System.out.println("!!! <<< transformInfo - symbol: " + Debug.show(symbol));
- if (show && !symbol.isPackage()) System.out.println("!!! <<< transformInfo - type : " + Debug.show(type));
- if (symbol.isPackage()) return type; // !!!
+ if (show && !symbol.isPackageClass()) System.out.println("!!! <<< transformInfo - symbol: " + Debug.show(symbol));
+ if (show && !symbol.isPackageClass()) System.out.println("!!! <<< transformInfo - type : " + Debug.show(type));
+ if (symbol.isPackageClass()) return type; // !!!
TypeContext context = getTypeContextFor(symbol);
if (symbol.isConstructor() && symbol.constructorClass().isClassType()) { // !!! isClassType -> isClass ?
Symbol clasz = symbol.constructorClass();
@@ -106,8 +106,8 @@ public class ExplicitOuterClassesPhase extends Phase {
type = context.transformer.apply(type);
assert type != null: Debug.show(symbol) + " -- " + t;
}
- if (show && !symbol.isPackage()) System.out.println("!!! >>> transformInfo - symbol: " + Debug.show(symbol));
- if (show && !symbol.isPackage()) System.out.println("!!! >>> transformInfo - type : " + Debug.show(type));
+ if (show && !symbol.isPackageClass()) System.out.println("!!! >>> transformInfo - symbol: " + Debug.show(symbol));
+ if (show && !symbol.isPackageClass()) System.out.println("!!! >>> transformInfo - type : " + Debug.show(type));
return type;
}
@@ -204,7 +204,7 @@ public class ExplicitOuterClassesPhase extends Phase {
for (int o = 0; o < context.outers.length - 1; o++) {
if (!context.outers[o].isStable)
types[--p] = prefix;
- else if (context.outers[o].clasz.isPackage()) break;
+ else if (context.outers[o].clasz.isPackageClass()) break;
Type base = prefix.baseType(context.outers[o].clasz);
assert base.symbol() == context.outers[o].clasz:
prefix + " -- " + Debug.show(clasz) + " -- " + context.outers[o].clasz + " -- " + base;
@@ -248,7 +248,7 @@ public class ExplicitOuterClassesPhase extends Phase {
/** !!! */
public TypeContext(Symbol clasz, TypeContext[] outers, Symbol[] tlinks, Symbol vlink, Symbol[] oldtparams, Map tparams) {
this.clasz = clasz;
- this.isStable = clasz.isPackage() || (clasz.isModuleClass() && vlink == null);
+ this.isStable = clasz.isPackageClass() || (clasz.isModuleClass() && vlink == null);
this.outers = outers;
this.tlinks = tlinks;
this.vlink = vlink;
@@ -309,7 +309,7 @@ public class ExplicitOuterClassesPhase extends Phase {
prefix = Type.NoPrefix;
return Type.typeRef(prefix, symbol, args);
}
- if (symbol.isPackage()) {
+ if (symbol.isPackageClass()) {
args = Type.EMPTY_ARRAY;
prefix = Type.NoPrefix;
return Type.typeRef(prefix, symbol, args);
@@ -525,11 +525,11 @@ public class ExplicitOuterClassesPhase extends Phase {
tcontext = context.context.outers[i];
assert tcontext != null: Debug.show(clasz, " -- ", context.clasz);
if (tcontext.isStable) {
- if (!clasz.owner().isPackage()) {
+ if (!clasz.owner().isPackageClass()) {
Tree qualifier = genOuterRef(pos,tcontext.outers[0].clasz);
return gen.Select(pos, qualifier, clasz.module());
} else {
- assert clasz.owner().isPackage(): Debug.show(clasz);
+ assert clasz.owner().isPackageClass(): Debug.show(clasz);
return gen.Ident(pos, clasz.module());
}
} else {