<commit_before>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;
    }

}<commit_msg>Allow non-recursive bindings for the "old" patt...<commit_after>/*     ____ ____  ____ ____  ______                                     *\
**    / __// __ \/ __// __ \/ ____/    SOcos COmpiles Scala             **
**  __\_ \/ /_/ / /__/ /_/ /\_ \       (c) 2002, LAMP/EPFL              **
** /_____/\____/\___/\____/____/                                        **
**                                                                      **
** $Id$
\*                                                                      */

package scalac.transformer.matching;

import scalac.ast.*;
import scalac.util.*;
import scalac.symtab.*;
import java.util.*;


public class TestRegTraverser extends Traverser {
    boolean result = false;
	Set variables = new HashSet();

    public void traverse(Tree tree) {
    	if (!result)
			switch (tree) {
				case Alternative(Tree[] ts):
					result = true;
					break;
				case Bind(_, Tree pat):
					variables.add(tree.symbol());
					traverse(pat);
					break;
				case Ident(_):
					if (variables.contains(tree.symbol()))
						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;
    }
}
{'fraction_non_alphanumeric': 0.1290626471973622, 'fraction_numerical': 0.0018841262364578427, 'mean_word_length': 1.835781041388518, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 5, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 8, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '370852', 'n_tokens_mistral': 724, 'n_tokens_neox': 641, 'n_words': 144}