diff options
author | buraq <buraq@epfl.ch> | 2004-01-09 09:45:27 +0000 |
---|---|---|
committer | buraq <buraq@epfl.ch> | 2004-01-09 09:45:27 +0000 |
commit | 64c98ed1390f50c333a3cabdd02003ce7feb74c3 (patch) | |
tree | 2f989d57be1292dfddc7083ca79db63690b9359b /sources/scalac/ast/TreeInfo.java | |
parent | f5919ef574e6d6cbdf96835db6f53ea80dca0991 (diff) | |
download | scala-64c98ed1390f50c333a3cabdd02003ce7feb74c3.tar.gz scala-64c98ed1390f50c333a3cabdd02003ce7feb74c3.tar.bz2 scala-64c98ed1390f50c333a3cabdd02003ce7feb74c3.zip |
disallowing forms of binding that lead to bug
Diffstat (limited to 'sources/scalac/ast/TreeInfo.java')
-rw-r--r-- | sources/scalac/ast/TreeInfo.java | 25 |
1 files changed, 25 insertions, 0 deletions
diff --git a/sources/scalac/ast/TreeInfo.java b/sources/scalac/ast/TreeInfo.java index 81c97a7e73..2aa95f401c 100644 --- a/sources/scalac/ast/TreeInfo.java +++ b/sources/scalac/ast/TreeInfo.java @@ -241,4 +241,29 @@ public class TreeInfo { return false; } } + /** this test should correspond to the one used in TransMatch phase */ + public static boolean isRegularPattern( Tree tree ) { + switch (tree) { + case Alternative(_): + return true; + case Bind(_, Tree pat): + return isRegularPattern( pat ); + case Ident(_): + return false; + case CaseDef(Tree pat, _, _): + isRegularPattern(pat); + break; + case Sequence( Tree[] trees): + return true; + case Apply( _, Tree[] trees ): + for( int i = 0; i < trees.length; i++ ) + if( isRegularPattern( trees[i] ) ) + return true; + case Literal( _ ): + return false; + + } + return false; + } + } |