diff options
author | buraq <buraq@epfl.ch> | 2005-06-10 13:15:41 +0000 |
---|---|---|
committer | buraq <buraq@epfl.ch> | 2005-06-10 13:15:41 +0000 |
commit | 6ad31934e9c09b5523b3d7304e4014ff1c3037df (patch) | |
tree | 54421630298bb08905662cbe96750f767435b5b9 /sources | |
parent | 4ae459ef755dccc8230a884bf6f462c4dadc96b8 (diff) | |
download | scala-6ad31934e9c09b5523b3d7304e4014ff1c3037df.tar.gz scala-6ad31934e9c09b5523b3d7304e4014ff1c3037df.tar.bz2 scala-6ad31934e9c09b5523b3d7304e4014ff1c3037df.zip |
comments, bugfix carried over from old matcher
Diffstat (limited to 'sources')
-rw-r--r-- | sources/scala/tools/nsc/ast/Trees.scala | 19 | ||||
-rw-r--r-- | sources/scala/tools/nsc/matching/TransMatcher.scala | 3 |
2 files changed, 18 insertions, 4 deletions
diff --git a/sources/scala/tools/nsc/ast/Trees.scala b/sources/scala/tools/nsc/ast/Trees.scala index 2e3822272a..d207a0352d 100644 --- a/sources/scala/tools/nsc/ast/Trees.scala +++ b/sources/scala/tools/nsc/ast/Trees.scala @@ -195,7 +195,14 @@ abstract class Trees: Global { } /** Labelled expression - the symbols in the array (must be Idents!) - * are those the label takes as argument */ + * are those the label takes as argument + * + * jumps are apply nodes attributed with label symbol, the arguements + * will get assigned to the idents. + * + * note: on 2005-06-09 Martin, Iuli, Burak agreed to have forward + * jumps within a Block. + */ case class LabelDef(name: Name, params: List[Ident], rhs: Tree) extends DefTree with TermTree; @@ -256,11 +263,17 @@ abstract class Trees: Global { def CaseDef(pat: Tree, body: Tree): CaseDef = CaseDef(pat, EmptyTree, body); /** Sequence of expression/patterns (comma separated expressions), - * eliminated by TransMatch */ + * in patterns, eliminated by TransMatch + * in expressions, seq constructors that need to be translated in backend, + * ideally like this: Sequence(t1,...,tn) = Vector({t1,...,tn}), + * where { ... } is an array. + */ case class Sequence(trees: List[Tree]) extends TermTree; - /** Alternatives of patterns, eliminated by TransMatch */ + /** Alternatives of patterns, eliminated by TransMatch, except for + * occurences in encoded Switch stmt (=remaining Match(CaseDef(...)) + */ case class Alternative(trees: List[Tree]) extends TermTree; diff --git a/sources/scala/tools/nsc/matching/TransMatcher.scala b/sources/scala/tools/nsc/matching/TransMatcher.scala index f829aa18db..869e706d63 100644 --- a/sources/scala/tools/nsc/matching/TransMatcher.scala +++ b/sources/scala/tools/nsc/matching/TransMatcher.scala @@ -125,7 +125,8 @@ with RightTracers { class TransMatch extends Transformer { def isRegular(pat:Tree): Boolean = pat match { - case Alternative(_) => true + case Alternative(trees) => + trees exists { isRegular } case Star(_) => true; case Ident(_) => false |