File tree Expand file tree Collapse file tree 4 files changed +39
-1
lines changed
compiler/src/dotty/tools/dotc/transform Expand file tree Collapse file tree 4 files changed +39
-1
lines changed Original file line number Diff line number Diff line change @@ -27,7 +27,20 @@ class Flatten extends MiniPhaseTransform with SymTransformer { thisTransform =>
27
27
else ref
28
28
}
29
29
30
- private val liftedDefs = new mutable.ListBuffer [Tree ]
30
+ private var liftedDefs = new mutable.ListBuffer [Tree ]
31
+ private var liftedDefsQueue = List .empty[mutable.ListBuffer [Tree ]]
32
+
33
+ override def prepareForPackageDef (tree : PackageDef )(implicit ctx : Context ) = {
34
+ liftedDefsQueue = liftedDefs :: liftedDefsQueue
35
+ liftedDefs = new mutable.ListBuffer [Tree ]
36
+ this
37
+ }
38
+
39
+ override def transformPackageDef (tree : PackageDef )(implicit ctx : Context , info : TransformerInfo ) = {
40
+ liftedDefs = liftedDefsQueue.head
41
+ liftedDefsQueue = liftedDefsQueue.tail
42
+ tree
43
+ }
31
44
32
45
private def liftIfNested (tree : Tree )(implicit ctx : Context , info : TransformerInfo ) =
33
46
if (ctx.owner is Package ) tree
Original file line number Diff line number Diff line change
1
+ class Foo {
2
+ new Object { }
3
+ }
4
+
5
+ package bar { }
Original file line number Diff line number Diff line change
1
+ Foo$$anon$1
2
+ bar.Bar$$anon$2
Original file line number Diff line number Diff line change
1
+ object Test {
2
+ def main (args : Array [String ]): Unit = {
3
+ new Foo
4
+ new bar.Bar
5
+ }
6
+ }
7
+
8
+ class Foo {
9
+ new Object { println(this .getClass.getName) }
10
+ }
11
+
12
+ package bar {
13
+ package baz { }
14
+ class Bar {
15
+ new Object { println(this .getClass.getName) }
16
+ }
17
+ package quxx { }
18
+ }
You can’t perform that action at this time.
0 commit comments