diff options
author | schinz <schinz@epfl.ch> | 2003-08-29 11:17:36 +0000 |
---|---|---|
committer | schinz <schinz@epfl.ch> | 2003-08-29 11:17:36 +0000 |
commit | 41af0bf85b59c395ac83121b473c52c90acf988b (patch) | |
tree | a58ef01ff5786117fbe2fa46dfc91b55c67efe0d | |
parent | 108c95de6333f113129e63bb049e81d8b1a0924c (diff) | |
download | scala-41af0bf85b59c395ac83121b473c52c90acf988b.tar.gz scala-41af0bf85b59c395ac83121b473c52c90acf988b.tar.bz2 scala-41af0bf85b59c395ac83121b473c52c90acf988b.zip |
- replaced empty trees in right-hand sides of v...
- replaced empty trees in right-hand sides of variable definitions by
default values (i.e. produce exactly the same trees as are produced
when the programmer writes "var x = _")
-rw-r--r-- | sources/scalac/transformer/matching/AlgebraicMatcher.java | 4 | ||||
-rw-r--r-- | sources/scalac/transformer/matching/PatternMatcher.java | 4 |
2 files changed, 6 insertions, 2 deletions
diff --git a/sources/scalac/transformer/matching/AlgebraicMatcher.java b/sources/scalac/transformer/matching/AlgebraicMatcher.java index b94521bb43..2e1b389740 100644 --- a/sources/scalac/transformer/matching/AlgebraicMatcher.java +++ b/sources/scalac/transformer/matching/AlgebraicMatcher.java @@ -468,7 +468,9 @@ public class AlgebraicMatcher extends PatternTool { public Tree toTree() { TreeList ts = new TreeList(); ts.append( gen.ValDef(_m.pos, root.symbol(), _m.selector )); - ts.append( gen.ValDef(_m.pos, resultVar, Tree.Empty )); + ts.append( gen.ValDef(_m.pos, + resultVar, + gen.mkDefaultValue(_m.pos, resultVar.info()) )); ts.append( cf.If( toTree(root.and), gen.Ident( _m.pos, resultVar ), cf.ThrowMatchError( _m.pos, _m.resultType ))); diff --git a/sources/scalac/transformer/matching/PatternMatcher.java b/sources/scalac/transformer/matching/PatternMatcher.java index 47b7ca67ef..21d5b1a595 100644 --- a/sources/scalac/transformer/matching/PatternMatcher.java +++ b/sources/scalac/transformer/matching/PatternMatcher.java @@ -784,7 +784,9 @@ public class PatternMatcher extends PatternTool { Modifiers.MUTABLE, resultVar.name, gen.mkType(selector.pos, typeOf(resultVar)), - Tree.Empty).setType(defs.UNIT_TYPE).setSymbol(resultVar)); + gen.mkDefaultValue(selector.pos, typeOf(resultVar))) + .setType(defs.UNIT_TYPE) + .setSymbol(resultVar)); ts.append( make.If( selector.pos, |