diff options
Diffstat (limited to 'sources/scalac/transformer/matching/AlgebraicMatcher.java')
-rw-r--r-- | sources/scalac/transformer/matching/AlgebraicMatcher.java | 42 |
1 files changed, 7 insertions, 35 deletions
diff --git a/sources/scalac/transformer/matching/AlgebraicMatcher.java b/sources/scalac/transformer/matching/AlgebraicMatcher.java index 5cda065dbd..6b0afd8fa5 100644 --- a/sources/scalac/transformer/matching/AlgebraicMatcher.java +++ b/sources/scalac/transformer/matching/AlgebraicMatcher.java @@ -156,15 +156,7 @@ public class AlgebraicMatcher extends PatternTool { /** adds a case definition to the intermediate presentation */ protected CaseEnv addCase(int pos, Tree pat, Tree guard, Tree body, int case_index) { - // TMP - /* - System.out.print("AM: addCase... pattern has variables:"); - CollectVariableTraverser cvt = new CollectVariableTraverser(); - cvt.traverse( pat ); - System.out.println(cvt.vars); - */ - - // TMP + CaseEnv env = new CaseEnv( _m.owner, unit ); //PatternNode matched = match(pat, root); @@ -172,13 +164,6 @@ public class AlgebraicMatcher extends PatternTool { //if (target.and != null) // unit.error(pat.pos, "duplicate case"); - /* - System.out.print( "AM.addCase boundvars:{"); - ValDef bvs[] = env.boundVars(); - for( int j = 0; j < bvs.length; j++ ) - System.out.print(" "+bvs[ j ].symbol() ); - */ - if (target.and == null) target.and = mk.Body(pos, env.boundVars(), guard, body); else if (target.and instanceof Body) @@ -279,25 +264,12 @@ public class AlgebraicMatcher extends PatternTool { case Literal(Object value): return mk.ConstantPat(tree.pos, theType, value); - case Sequence( _ ): - throw new ApplicationError("Illegal pattern"); - //return mk.SeqContainerPat(tree.pos, tree, case_index); - //return mk.SeqContainerPat(tree.pos, null, 0, tree); - - //case Subsequence( _ ): // this may not appear here. - /*case Bind( Name n, Tree t ): // ignore for now, treat as var x - - return patternN( gen.Ident( tree.pos, tree.symbol() ), - castType, - headerSel - env, - case_index); - */ - //case Alternative( _ ): // ignore for now - default: - throw new ApplicationError("cannot handle "+tree); - } - } + case Sequence( _ ): + throw new ApplicationError("Illegal pattern"); + default: + throw new ApplicationError("cannot handle "+tree); + } + } /** returns true if p and q are pattern nodes of the same kind and p matches * whenever q matches, possibly even more often |