diff options
author | Martin Odersky <odersky@gmail.com> | 2015-06-19 16:15:04 +0200 |
---|---|---|
committer | Martin Odersky <odersky@gmail.com> | 2015-06-19 16:15:04 +0200 |
commit | 25304a028e6d1426b14ead4a469c362b8536d893 (patch) | |
tree | 061bd796b2d65ad7b55df32ba34f57268e6c6b47 /src/dotty/tools/dotc/ast/tpd.scala | |
parent | bbc584f0ac3586ce4e4a92e58f74ad69a15f0ed5 (diff) | |
download | dotty-25304a028e6d1426b14ead4a469c362b8536d893.tar.gz dotty-25304a028e6d1426b14ead4a469c362b8536d893.tar.bz2 dotty-25304a028e6d1426b14ead4a469c362b8536d893.zip |
Add initializers for lambdalift proxy fields
If an inner class has proxy fields, we missed so far the assignment sfrom
the proxy parameters in the primary constructor of the class to the proxy
fields.
Test case tries several variations of this.
Diffstat (limited to 'src/dotty/tools/dotc/ast/tpd.scala')
-rw-r--r-- | src/dotty/tools/dotc/ast/tpd.scala | 9 |
1 files changed, 7 insertions, 2 deletions
diff --git a/src/dotty/tools/dotc/ast/tpd.scala b/src/dotty/tools/dotc/ast/tpd.scala index 51011f90b..a35e0e523 100644 --- a/src/dotty/tools/dotc/ast/tpd.scala +++ b/src/dotty/tools/dotc/ast/tpd.scala @@ -76,8 +76,13 @@ object tpd extends Trees.Instance[Type] with TypedTreeInfo { def Block(stats: List[Tree], expr: Tree)(implicit ctx: Context): Block = ta.assignType(untpd.Block(stats, expr), stats, expr) - def maybeBlock(stats: List[Tree], expr: Tree)(implicit ctx: Context): Tree = - if (stats.isEmpty) expr else Block(stats, expr) + /** Join `stats` in front of `expr` creating a new block if necessary */ + def seq(stats: List[Tree], expr: Tree)(implicit ctx: Context): Tree = + if (stats.isEmpty) expr + else expr match { + case Block(estats, eexpr) => cpy.Block(expr)(stats ::: estats, eexpr) + case _ => Block(stats, expr) + } def If(cond: Tree, thenp: Tree, elsep: Tree)(implicit ctx: Context): If = ta.assignType(untpd.If(cond, thenp, elsep), thenp, elsep) |