summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorpaltherr <paltherr@epfl.ch>2003-12-12 10:08:17 +0000
committerpaltherr <paltherr@epfl.ch>2003-12-12 10:08:17 +0000
commiteaedb73aa540915236b70752e8513960a8bb736a (patch)
tree3943b4c770702ab795d2ae2ac98540b7698be944
parenta7c75c09c62734683069eecbaeeb896cdf7eed86 (diff)
downloadscala-eaedb73aa540915236b70752e8513960a8bb736a.tar.gz
scala-eaedb73aa540915236b70752e8513960a8bb736a.tar.bz2
scala-eaedb73aa540915236b70752e8513960a8bb736a.zip
- Added method location and selection
-rw-r--r--sources/scalac/checkers/TreeChecker.java46
1 files changed, 46 insertions, 0 deletions
diff --git a/sources/scalac/checkers/TreeChecker.java b/sources/scalac/checkers/TreeChecker.java
index 45191d5edf..fb6f635bdc 100644
--- a/sources/scalac/checkers/TreeChecker.java
+++ b/sources/scalac/checkers/TreeChecker.java
@@ -214,6 +214,52 @@ public class TreeChecker {
}
//########################################################################
+ // Private Methods - Checking locations
+
+ /** Checks the location. Returns true. */
+ public boolean location(Tree tree) {
+ switch (tree) {
+
+ case Select(_, _):
+ Symbol symbol = tree.symbol();
+ assert symbol != null && symbol.isTerm(): show(tree);
+ assert !symbol.isMethod(): show(tree);
+ return selection(tree);
+
+ case Ident(_):
+ Symbol symbol = tree.symbol();
+ assert symbol != null && symbol.isTerm(): show(tree);
+ if (symbol.isModule()) return true;
+ assert vvars.contains(symbol): show(tree);
+ return true;
+
+ default:
+ throw Debug.abort("illegal case", tree);
+ }
+ }
+
+ //########################################################################
+ // Private Methods - Checking selection
+
+ /** Checks the selection. Returns true. */
+ public boolean selection(Tree tree) {
+ switch (tree) {
+
+ case Select(Tree qualifier, _):
+ Symbol symbol = tree.symbol();
+ assert symbol != null && symbol.isTerm(): show(tree);
+ Symbol owner = symbol.owner();
+ assert owner.isClassType(): show(tree);
+ Type prefix = qualifier.type();
+ assert prefix.baseType(owner) != Type.NoType: show(tree);
+ return expression(qualifier, prefix);
+
+ default:
+ throw Debug.abort("illegal case", tree);
+ }
+ }
+
+ //########################################################################
// Private Methods - Declaring symbols
/** Do the trees contain the given symbols? */