summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorburaq <buraq@epfl.ch>2005-06-24 17:01:51 +0000
committerburaq <buraq@epfl.ch>2005-06-24 17:01:51 +0000
commit94da2c3d3618cc7533c3eb146cff23743d988c95 (patch)
tree677d1240d063c3975aaf676b2a30b456dfc4d0c8
parent3f2b3db06d14228c31b7e18317c68e4b0b1a50c1 (diff)
downloadscala-94da2c3d3618cc7533c3eb146cff23743d988c95.tar.gz
scala-94da2c3d3618cc7533c3eb146cff23743d988c95.tar.bz2
scala-94da2c3d3618cc7533c3eb146cff23743d988c95.zip
works now
-rw-r--r--sources/scala/tools/nsc/matching/TransMatcher.scala20
1 files changed, 17 insertions, 3 deletions
diff --git a/sources/scala/tools/nsc/matching/TransMatcher.scala b/sources/scala/tools/nsc/matching/TransMatcher.scala
index 3cdcaa42db..1564beca18 100644
--- a/sources/scala/tools/nsc/matching/TransMatcher.scala
+++ b/sources/scala/tools/nsc/matching/TransMatcher.scala
@@ -72,7 +72,9 @@ with RightTracers {
def fresh = cunit.fresh ;
- var owner: Symbol = _;
+ var currentOwner: Symbol = _;
+
+ var resultType: Type = _;
def containsBinding(pat: Tree): Boolean = {
var generatedVars = false;
@@ -147,6 +149,13 @@ with RightTracers {
case Literal(_) => false;
case Select(_,_) => false;
case Typed(_,_) => false;
+
+ //case _ =>
+ // Console.println(pat);
+ // Console.println(pat.getClass());
+ // scala.Predef.error(" what is this ? ")
+
+
}
@@ -202,6 +211,7 @@ with RightTracers {
def handle(sel:Tree, cases:List[CaseDef]): Tree = {
+
// 1. is there a regular pattern?
val containsReg = cases.exists { x => isRegular(x.pat) };
@@ -217,7 +227,6 @@ with RightTracers {
val owner = currentOwner;
val selector = sel ;
}
- TransMatcher.this.owner = currentOwner; // @todo: remove from partial matcher
//new AlgebraicMatcher() {
// val tm: TransMatcher.this.type = TransMatcher.this;
//}.construct( matcher, ncases );
@@ -238,7 +247,12 @@ with RightTracers {
override def transform(tree: Tree): Tree = tree match {
case Match(selector, cases) =>
val ts = cases map { transform };
- handle(transform(selector), ts.asInstanceOf[List[CaseDef]]);
+ // @todo: remove from partial matcher
+ TransMatcher.this.currentOwner = currentOwner;
+ TransMatcher.this.resultType = tree.tpe;
+ //Console.println("TransMatcher selector.tpe ="+selector.tpe+")");
+ handle(transform(selector).setType(selector.tpe),
+ ts.asInstanceOf[List[CaseDef]]);
case _ =>
super.transform(tree);
}