summaryrefslogtreecommitdiff
path: root/sources/scalac/transformer/matching/AlgebraicMatcher.java
diff options
context:
space:
mode:
authorburaq <buraq@epfl.ch>2003-07-13 11:42:52 +0000
committerburaq <buraq@epfl.ch>2003-07-13 11:42:52 +0000
commite31cc564d5ad9a112a258360f98707aed7c3a619 (patch)
treedf9a7a62180619dcd9eb7d5b8d73f4f9607cc133 /sources/scalac/transformer/matching/AlgebraicMatcher.java
parente96d1be7b64a67733cc589f258af1baecaeaf6dd (diff)
downloadscala-e31cc564d5ad9a112a258360f98707aed7c3a619.tar.gz
scala-e31cc564d5ad9a112a258360f98707aed7c3a619.tar.bz2
scala-e31cc564d5ad9a112a258360f98707aed7c3a619.zip
completed migration. code is now operational
Diffstat (limited to 'sources/scalac/transformer/matching/AlgebraicMatcher.java')
-rw-r--r--sources/scalac/transformer/matching/AlgebraicMatcher.java13
1 files changed, 7 insertions, 6 deletions
diff --git a/sources/scalac/transformer/matching/AlgebraicMatcher.java b/sources/scalac/transformer/matching/AlgebraicMatcher.java
index 45995c39d2..5cda065dbd 100644
--- a/sources/scalac/transformer/matching/AlgebraicMatcher.java
+++ b/sources/scalac/transformer/matching/AlgebraicMatcher.java
@@ -18,6 +18,7 @@ import Tree.*;
import scalac.transformer.TransMatch.Matcher ;
import scalac.util.Name ;
+import scalac.util.Names ;
//import scalac.ast.printer.TextTreePrinter ;
import java.util.Vector ;
@@ -238,7 +239,7 @@ public class AlgebraicMatcher extends PatternTool {
case Typed(Ident(Name name), Tree tpe): // typed pattern
theType = getConstrType( tpe.type );
assert (env != null ) : "env is null";
- if (/*(env != null) &&*/ (name != WILDCARD_N))
+ if (/*(env != null) &&*/ (name != Names.WILDCARD))
env.newBoundVar(tree.pos,
((Tree.Typed)tree).expr.symbol(),
theType,
@@ -249,7 +250,7 @@ public class AlgebraicMatcher extends PatternTool {
else
return mk.ConstrPat( tree.pos, theType );
case Bind(Name name, Ident(Name id)): // x @ _
- if( id == WILDCARD_N ) {
+ if( id == Names.WILDCARD ) {
env.newBoundVar(tree.pos,
tree.symbol(),
theType,
@@ -258,11 +259,11 @@ public class AlgebraicMatcher extends PatternTool {
}
throw new ApplicationError("cannot handle "+tree);
case Ident(Name name): // pattern without args or variable
- if (tree.symbol().isPrimaryConstructor())
+ if ((tree.symbol() != null) && tree.symbol().isPrimaryConstructor())
return mk.ConstrPat(tree.pos, theType);
else if (name.isVariable()) {
assert (env != null ) : "env is null";
- if (/*(env != null) &&*/ (name != WILDCARD_N))
+ if (/*(env != null) &&*/ (name != Names.WILDCARD))
env.newBoundVar(tree.pos,
tree.symbol(),
theType,
@@ -583,8 +584,8 @@ public class AlgebraicMatcher extends PatternTool {
toTree(node.and),
toTree(node.or, selector)).setType(defs.BOOLEAN_TYPE);
case VariablePat(Tree tree):
- System.out.print("VariablePat");
- System.out.println( tree );
+ //System.out.print("VariablePat");
+ //System.out.println( tree );
return make.If( selector.pos,
cf.Equals(selector, tree),
toTree(node.and),