diff options
author | paltherr <paltherr@epfl.ch> | 2003-07-30 14:51:58 +0000 |
---|---|---|
committer | paltherr <paltherr@epfl.ch> | 2003-07-30 14:51:58 +0000 |
commit | 728ab1f19fd79630b4c0919b960dad9ecf6055f1 (patch) | |
tree | a24abf1d22c8ed7eb22c7bc2d3b283797f1ab0aa /sources/scalac/ast | |
parent | 8684be678d835f938a063ce9887370058254a22d (diff) | |
download | scala-728ab1f19fd79630b4c0919b960dad9ecf6055f1.tar.gz scala-728ab1f19fd79630b4c0919b960dad9ecf6055f1.tar.bz2 scala-728ab1f19fd79630b4c0919b960dad9ecf6055f1.zip |
- Repolaced Tree argument of This and Super nod...
- Repolaced Tree argument of This and Super nodes by a Name argument
Diffstat (limited to 'sources/scalac/ast')
-rw-r--r-- | sources/scalac/ast/TreeGen.java | 9 | ||||
-rw-r--r-- | sources/scalac/ast/TreeInfo.java | 4 | ||||
-rw-r--r-- | sources/scalac/ast/parser/Parser.java | 23 | ||||
-rw-r--r-- | sources/scalac/ast/printer/TextTreePrinter.java | 13 |
4 files changed, 26 insertions, 23 deletions
diff --git a/sources/scalac/ast/TreeGen.java b/sources/scalac/ast/TreeGen.java index c3b22d9ac1..f890a63a61 100644 --- a/sources/scalac/ast/TreeGen.java +++ b/sources/scalac/ast/TreeGen.java @@ -108,7 +108,7 @@ public class TreeGen implements Kinds, Modifiers { public Tree mkStableId(int pos, Type pre) { switch (pre.expandModuleThis()) { case ThisType(Symbol sym): - return make.This(pos, Ident(pos, sym)).setType(pre); + return This(pos, sym); case SingleType(Type pre1, Symbol sym): return mkStable(mkRef(pos, pre1, sym)); default: @@ -462,14 +462,13 @@ public class TreeGen implements Kinds, Modifiers { /** Build and attribute this node with given symbol. */ public Tree This(int pos, Symbol sym) { - Type type = sym.thisType(); - return make.This(pos, TypeTerm(pos, type)).setType(type); + return make.This(pos, sym).setType(sym.thisType()); } /** Build and attribute super node with given type. */ - public Tree Super(int pos, Type type) { - return make.Super(pos, TypeTerm(pos, type)).setType(type); + public Tree Super(int pos, Symbol sym) { + return make.Super(pos, sym).setType(sym.thisType()); } /** Build and attribute value/variable/let definition node whose signature diff --git a/sources/scalac/ast/TreeInfo.java b/sources/scalac/ast/TreeInfo.java index 7a0618c6b8..9c71e165f6 100644 --- a/sources/scalac/ast/TreeInfo.java +++ b/sources/scalac/ast/TreeInfo.java @@ -138,8 +138,8 @@ public class TreeInfo { */ public static boolean isSelf(Tree tree, Symbol enclClass) { switch (tree) { - case This(Tree qual): - return qual.symbol() == enclClass; + case This(_): + return tree.symbol() == enclClass; default: return false; } diff --git a/sources/scalac/ast/parser/Parser.java b/sources/scalac/ast/parser/Parser.java index 00670ab8fc..3d88b2decf 100644 --- a/sources/scalac/ast/parser/Parser.java +++ b/sources/scalac/ast/parser/Parser.java @@ -424,7 +424,7 @@ public class Parser implements Tokens { break; case Apply(Tree fn, Tree[] args): switch (fn) { - case This(Tree.Empty): + case This(TypeNames.EMPTY): return make.Apply( t.pos, make.Ident(t.pos, constrname), args); } @@ -515,26 +515,27 @@ public class Parser implements Tokens { Tree stableRef(boolean thisOK, boolean typeOK) { Tree t; if (s.token == THIS) { - t = make.This(s.skipToken(), Tree.Empty); + t = make.This(s.skipToken(), TypeNames.EMPTY); if (!thisOK || s.token == DOT) t = selectors(accept(DOT), t, typeOK); } else if (s.token == SUPER) { - t = make.Super(s.skipToken(), Tree.Empty); + t = make.Super(s.skipToken(), TypeNames.EMPTY); t = make.Select(accept(DOT), t, ident()); if (s.token == DOT) t = selectors(s.skipToken(), t, typeOK); } else { - t = make.Ident(s.pos, ident()); + Ident i = make.Ident(s.pos, ident()); + t = i; if (s.token == DOT) { int pos = s.skipToken(); if (s.token == THIS) { s.nextToken(); - t = make.This(pos, convertToTypeId(t)); + t = make.This(i.pos, i.name.toTypeName()); if (!thisOK || s.token == DOT) t = selectors(accept(DOT), t, typeOK); } else if (s.token == SUPER) { s.nextToken(); - t = make.Super(pos, convertToTypeId(t)); + t = make.Super(i.pos, i.name.toTypeName()); t = make.Select(accept(DOT), t, ident()); if (s.token == DOT) t = selectors(s.skipToken(), t, typeOK); @@ -1495,18 +1496,20 @@ public class Parser implements Tokens { int startpos = s.pos; int pos; if (s.token == THIS) { - t = make.This(s.skipToken(), Tree.Empty); + t = make.This(s.skipToken(), TypeNames.EMPTY); t = make.Select(accept(DOT), t, ident()); pos = accept(DOT); } else { - t = make.Ident(s.pos, ident()); + Ident i = make.Ident(s.pos, ident()); pos = accept(DOT); if (s.token == THIS) { s.nextToken(); - t = make.This(pos, convertToTypeId(t)); + t = make.This(i.pos, i.name.toTypeName()); t = make.Select(accept(DOT), t, ident()); pos = accept(DOT); - } + } else { + t = i; + } } while (true) { if (s.token == USCORE) { diff --git a/sources/scalac/ast/printer/TextTreePrinter.java b/sources/scalac/ast/printer/TextTreePrinter.java index dd46c8a710..8773c7e72e 100644 --- a/sources/scalac/ast/printer/TextTreePrinter.java +++ b/sources/scalac/ast/printer/TextTreePrinter.java @@ -15,6 +15,7 @@ import scalac.util.Debug; import scalac.Global; import scalac.Unit; import scalac.util.Name; +import scalac.util.TypeNames; import java.io.*; import java.util.*; @@ -479,18 +480,18 @@ public class TextTreePrinter implements TreePrinter { printType(tree); break; - case Super(Tree qualifier): - if (qualifier != Tree.Empty) { - print(qualifier); + case Super(Name name): + if (name != TypeNames.EMPTY) { + printSymbolUse(tree.symbol(), name); print(TXT_DOT); } print(KW_SUPER); printType(tree); break; - case This(Tree qualifier): - if (qualifier != Tree.Empty) { - print(qualifier); + case This(Name name): + if (name != TypeNames.EMPTY) { + printSymbolUse(tree.symbol(), name); print(TXT_DOT); } print(KW_THIS); |