diff options
author | Paul Phillips <paulp@improving.org> | 2012-01-07 15:00:26 -0800 |
---|---|---|
committer | Paul Phillips <paulp@improving.org> | 2012-01-07 22:51:02 -0800 |
commit | 04af2eb976bf5b3aec9577837ca03db327d09825 (patch) | |
tree | a352edd06f8e44d3c6703fe85c0502ce88989489 /src/compiler/scala/reflect/internal/Trees.scala | |
parent | f7ae1388324e6f0062ebe1cc348177304dd6419d (diff) | |
download | scala-04af2eb976bf5b3aec9577837ca03db327d09825.tar.gz scala-04af2eb976bf5b3aec9577837ca03db327d09825.tar.bz2 scala-04af2eb976bf5b3aec9577837ca03db327d09825.zip |
Cleanups in Cleanup.
Seeing about getting delayedInit working (not to mention the
breakage it is inflicting elsewhere) which led me into Cleanup
and some of its buddies.
Diffstat (limited to 'src/compiler/scala/reflect/internal/Trees.scala')
-rw-r--r-- | src/compiler/scala/reflect/internal/Trees.scala | 11 |
1 files changed, 7 insertions, 4 deletions
diff --git a/src/compiler/scala/reflect/internal/Trees.scala b/src/compiler/scala/reflect/internal/Trees.scala index 4ca55f53ea..96f2c5cc45 100644 --- a/src/compiler/scala/reflect/internal/Trees.scala +++ b/src/compiler/scala/reflect/internal/Trees.scala @@ -248,10 +248,13 @@ trait Trees extends api.Trees { self: SymbolTable => /** Block factory that flattens directly nested blocks. */ - def Block(stats: Tree*): Block = stats match { - case Seq(b @ Block(_, _)) => b - case Seq(stat) => Block(stats.toList, Literal(Constant(()))) - case Seq(_, rest @ _*) => Block(stats.init.toList, stats.last) + def Block(stats: Tree*): Block = { + if (stats.isEmpty) Block(Nil, Literal(Constant(()))) + else stats match { + case Seq(b @ Block(_, _)) => b + case Seq(stat) => Block(stats.toList, Literal(Constant(()))) + case Seq(_, rest @ _*) => Block(stats.init.toList, stats.last) + } } // --- specific traversers and transformers |