diff options
author | Dmitry Petrashko <dmitry.petrashko@gmail.com> | 2015-04-30 15:42:07 +0200 |
---|---|---|
committer | Dmitry Petrashko <dmitry.petrashko@gmail.com> | 2015-04-30 15:42:07 +0200 |
commit | 61f0517d17b2dab40643d26f2bd1c111ad3792e9 (patch) | |
tree | 13c59c78254e2dc90604fd394ccf534d1ba0832f | |
parent | 98f8ab8537043a0a611158ee7deb01abbb07ff5f (diff) | |
download | dotty-61f0517d17b2dab40643d26f2bd1c111ad3792e9.tar.gz dotty-61f0517d17b2dab40643d26f2bd1c111ad3792e9.tar.bz2 dotty-61f0517d17b2dab40643d26f2bd1c111ad3792e9.zip |
Comment why LazyVals needs to reorder stats in blocks.
-rw-r--r-- | src/dotty/tools/dotc/transform/LazyVals.scala | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/src/dotty/tools/dotc/transform/LazyVals.scala b/src/dotty/tools/dotc/transform/LazyVals.scala index 503b1c277..cc8ad8cdc 100644 --- a/src/dotty/tools/dotc/transform/LazyVals.scala +++ b/src/dotty/tools/dotc/transform/LazyVals.scala @@ -121,10 +121,14 @@ class LazyVals extends MiniPhaseTransform with IdentityDenotTransformer { override def transformStats(trees: List[tpd.Tree])(implicit ctx: Context, info: TransformerInfo): List[tpd.Tree] = { + // backend requires field usage to be after field definition + // need to bring containers to start of method val (holders, stats) = atGroupEnd { implicit ctx: Context => trees.partition { - _.symbol.flags == containerFlags + _.symbol.flags.&~(Flags.Touched) == containerFlags + // Filtering out Flags.Touched is not required currently, as there are no LazyTypes involved here + // but just to be more safe } } holders:::stats |