package scalac.transformer.matching ;

import scalac.ast.Tree;
import scalac.util.Name;
import scalac.symtab.Symbol ;
import scalac.ast.Traverser ;

import Tree.Ident;
import Tree.Bind;

public class TestRegTraverser extends Traverser {

    boolean result;

    public TestRegTraverser() {
	super();
	result = false;
    }

    public void traverse(Tree tree) {
	switch (tree) {
	case Alternative(Tree[] ts):
	case Bind(_, _):
	    result = true;
	    break;
	default:
	    super.traverse( tree );
	}
    }

    public static boolean apply( Tree t ) {
	TestRegTraverser trt = new TestRegTraverser();
	trt.traverse( t );
	//System.err.println("TestRegTraverser says "+t+" -> "+trt.result);
	return trt.result;
    }

}

@@ -1,8 +1,467 @@
+/*     ____ ____  ____ ____  ______                                     *%5C%0A**    / __// __ %5C/ __// __ %5C/ ____/    SOcos COmpiles Scala             **%0A**  __%5C_ %5C/ /_/ / /__/ /_/ /%5C_ %5C       (c) 2002, LAMP/EPFL              **%0A** /_____/%5C____/%5C___/%5C____/____/                                        **%0A**                                                                      **%0A** $Id$%0A%5C*                                                                      */%0A%0A
 package 
@@ -487,17 +487,16 @@
 matching
- 
 ;%0A%0Aimpor
@@ -508,20 +508,17 @@
 lac.ast.
-Tree
+*
 ;%0Aimport
@@ -534,12 +534,9 @@
 til.
-Name
+*
 ;%0Aim
@@ -558,15 +558,9 @@
 tab.
-Symbol 
+*
 ;%0Aim
@@ -568,68 +568,21 @@
 ort 
-scalac.ast.Traverser ;%0A%0Aimport Tree.Ident;%0Aimport Tree.Bind;
+java.util.*;%0A
 %0A%0Apu
@@ -629,17 +629,16 @@
 erser %7B%0A
-%0A
     bool
@@ -651,75 +651,49 @@
 sult
-;%0A%0A    public TestRegTraverser() %7B%0A%09super();%0A%09result = false;%0A    %7D
+ = false;%0A%09Set variables = new HashSet();
 %0A%0A  
@@ -728,16 +728,36 @@
 tree) %7B%0A
+    %09if (!result)%0A%09%09
 %09switch 
@@ -765,16 +765,19 @@
 tree) %7B%0A
+%09%09%09
 %09case Al
@@ -803,30 +803,203 @@
 ):%0A%09
-case Bind(_, _):%0A%09    
+%09%09%09%09result = true;%0A%09%09%09%09%09break;%0A%09%09%09%09case Bind(_, Tree pat):%0A%09%09%09%09%09variables.add(tree.symbol());%0A%09%09%09%09%09traverse(pat);%0A%09%09%09%09%09break;%0A%09%09%09%09case Ident(_):%0A%09%09%09%09%09if (variables.contains(tree.symbol()))%0A%09%09%09%09%09%09
 resu
@@ -1014,19 +1014,22 @@
 e;%0A%09
-    
+%09%09%09%09
 break;%0A
+%09%09%09
 %09def
@@ -1035,20 +1035,20 @@
 fault:%0A%09
-    
+%09%09%09%09
 super.tr
@@ -1063,16 +1063,18 @@
 tree );%0A
+%09%09
 %09%7D%0A    %7D
@@ -1111,21 +1111,26 @@
 ply(
- 
 Tree t
- 
 ) %7B%0A
-%09
+        
 Test
@@ -1172,17 +1172,24 @@
 rser();%0A
-%09
+        
 trt.trav
@@ -1197,15 +1197,20 @@
 rse(
- t );%0A%09
+t);%0A        
 //Sy
@@ -1273,17 +1273,24 @@
 esult);%0A
-%09
+        
 return t
@@ -1306,11 +1306,10 @@
 ;%0A    %7D%0A
-%0A
 %7D%0A

Allow non-recursive bindings for the "old" patt...