summaryrefslogtreecommitdiff
path: root/sources/scalac/ast
diff options
context:
space:
mode:
authorpaltherr <paltherr@epfl.ch>2004-03-06 15:50:23 +0000
committerpaltherr <paltherr@epfl.ch>2004-03-06 15:50:23 +0000
commit8ba6023e7aa181b4e7e3206caf29c0550315f5b4 (patch)
treef3282a488b1c7c20eb7158ef1c162e27dfd905c7 /sources/scalac/ast
parent72a496a3c41ae105c852ea0f7fee1712efd68264 (diff)
downloadscala-8ba6023e7aa181b4e7e3206caf29c0550315f5b4.tar.gz
scala-8ba6023e7aa181b4e7e3206caf29c0550315f5b4.tar.bz2
scala-8ba6023e7aa181b4e7e3206caf29c0550315f5b4.zip
- Generalized the use of static types/trees in ...
- Generalized the use of static types/trees in static contextes. Now all this-types should refer to an enclosing class and all Tree.Select should refer a non-static class member.
Diffstat (limited to 'sources/scalac/ast')
-rw-r--r--sources/scalac/ast/TreeGen.java20
1 files changed, 9 insertions, 11 deletions
diff --git a/sources/scalac/ast/TreeGen.java b/sources/scalac/ast/TreeGen.java
index 1367311374..77bc1f2600 100644
--- a/sources/scalac/ast/TreeGen.java
+++ b/sources/scalac/ast/TreeGen.java
@@ -254,17 +254,15 @@ public class TreeGen implements Kinds, Modifiers, TypeTags {
case NoPrefix:
return Ident(pos, symbol);
case ThisType(Symbol clasz):
- if (clasz.isRoot()) return Ident(pos, symbol); // !!! remove ?
- if (clasz.isPackage()) return mkRef(pos, mkGlobalRef(pos, clasz.module()), symbol); // !!!
return mkRef(pos, This(pos, clasz), symbol);
case SingleType(Type prefix, Symbol member):
- Tree tree = mkRef(pos, prefix, member);
- switch (tree.type()) {
+ Tree qualifier = mkRef(pos, prefix, member);
+ switch (qualifier.type()) {
case MethodType(Symbol[] params, _):
- assert params.length == 0: tree.type();
- tree = Apply(pos, tree);
+ assert params.length == 0: qualifier.type();
+ qualifier = Apply(pos, qualifier);
}
- return mkRef(pos, tree, symbol);
+ return mkRef(pos, qualifier, symbol);
default:
throw Debug.abort("illegal case", stable);
}
@@ -279,10 +277,10 @@ public class TreeGen implements Kinds, Modifiers, TypeTags {
/** Builds a global reference to given symbol. */
public Tree mkGlobalRef(int pos, Symbol symbol) {
assert symbol.isTerm(): Debug.show(symbol);
- Symbol owner = symbol.owner();
- if (owner.isRoot()) return Ident(pos, symbol);
- assert owner.isModuleClass(): Debug.show(symbol);
- return mkRef(pos, mkGlobalRef(pos, owner.module()), symbol);
+ global.nextPhase();
+ Type prefix = symbol.owner().staticPrefix();
+ global.prevPhase();
+ return mkRef(pos, prefix, symbol);
}
/** Builds a This node corresponding to given class. */