diff options
author | paltherr <paltherr@epfl.ch> | 2003-10-13 15:43:36 +0000 |
---|---|---|
committer | paltherr <paltherr@epfl.ch> | 2003-10-13 15:43:36 +0000 |
commit | 774bd9179ecc515902db63ef2ba7271e6d6d4a6e (patch) | |
tree | 8bcd236b0d46b796c821ac67337530947266d2a0 /sources/scalac/transformer/matching/AlgebraicMatcher.java | |
parent | a87e39db1f901094e959fd2121b5d7afe98a9c6c (diff) | |
download | scala-774bd9179ecc515902db63ef2ba7271e6d6d4a6e.tar.gz scala-774bd9179ecc515902db63ef2ba7271e6d6d4a6e.tar.bz2 scala-774bd9179ecc515902db63ef2ba7271e6d6d4a6e.zip |
- Addded Definitions.PATTERN_WILDCARD
- Removed Names.WILDCARD
- Added Names.PATTERN_WILDCARD
- Added Names.IMPORT_WILDCARD
- Replaced most uses of Names.PATTERN_WILDCARD by Definitions.PATTERN_WILDCARD
- Removed TreeInfo.isWildcardPattern
Diffstat (limited to 'sources/scalac/transformer/matching/AlgebraicMatcher.java')
-rw-r--r-- | sources/scalac/transformer/matching/AlgebraicMatcher.java | 14 |
1 files changed, 8 insertions, 6 deletions
diff --git a/sources/scalac/transformer/matching/AlgebraicMatcher.java b/sources/scalac/transformer/matching/AlgebraicMatcher.java index 57ba2ce7fe..0914cb7f15 100644 --- a/sources/scalac/transformer/matching/AlgebraicMatcher.java +++ b/sources/scalac/transformer/matching/AlgebraicMatcher.java @@ -189,10 +189,10 @@ public class AlgebraicMatcher extends PatternMatcher { return res; } return mk.ConstrPat(tree.pos, theType); - case Typed(Ident(Name name), Tree tpe): // typed pattern + case Typed(Ident ident, Tree tpe): // typed pattern theType = getConstrType( tpe.type ); assert (env != null ) : "env is null"; - if (/*(env != null) &&*/ (name != Names.WILDCARD)) + if (/*(env != null) &&*/ (ident.symbol() != defs.PATTERN_WILDCARD)) env.newBoundVar( ((Tree.Typed)tree).expr.symbol(), theType, @@ -202,8 +202,8 @@ public class AlgebraicMatcher extends PatternMatcher { return mk.DefaultPat( tree.pos, theType ); else return mk.ConstrPat( tree.pos, theType ); - case Bind(Name name, Ident(Name id)): // x @ _ - if( id == Names.WILDCARD ) { + case Bind(Name name, Ident ident): // x @ _ + if( ident.symbol() == defs.PATTERN_WILDCARD ) { env.newBoundVar( tree.symbol(), theType, @@ -212,11 +212,13 @@ public class AlgebraicMatcher extends PatternMatcher { } throw new ApplicationError("cannot handle "+tree); case Ident(Name name): // pattern without args or variable - if ((tree.symbol() != null) && tree.symbol().isPrimaryConstructor()) + Symbol symbol = tree.symbol(); + assert symbol != null: tree; + if (symbol.isPrimaryConstructor()) return mk.ConstrPat(tree.pos, theType); else if (name.isVariable()) { assert (env != null ) : "env is null"; - if (/*(env != null) &&*/ (name != Names.WILDCARD)) + if (/*(env != null) &&*/ (symbol != defs.PATTERN_WILDCARD)) env.newBoundVar( tree.symbol(), theType, |