From 8ba6023e7aa181b4e7e3206caf29c0550315f5b4 Mon Sep 17 00:00:00 2001 From: paltherr Date: Sat, 6 Mar 2004 15:50:23 +0000 Subject: - 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. --- sources/scalac/ast/TreeGen.java | 20 +++++++++----------- 1 file changed, 9 insertions(+), 11 deletions(-) (limited to 'sources/scalac/ast') 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. */ -- cgit v1.2.3