File tree 4 files changed +20
-10
lines changed
compiler/src/dotty/tools/dotc
4 files changed +20
-10
lines changed Original file line number Diff line number Diff line change @@ -48,13 +48,7 @@ class TreeMapWithImplicits extends tpd.TreeMapWithPreciseStatContexts {
48
48
override def transform (tree : Tree )(using Context ): Tree = {
49
49
try tree match {
50
50
case Block (stats, expr) =>
51
- inContext(nestedScopeCtx(stats)) {
52
- if stats.exists(_.isInstanceOf [Import ]) then
53
- // need to transform stats and expr together to account for import visibility
54
- val stats1 = transformStats(stats :+ expr, ctx.owner)
55
- cpy.Block (tree)(stats1.init, stats1.last)
56
- else super .transform(tree)
57
- }
51
+ super .transform(tree)(using nestedScopeCtx(stats))
58
52
case tree : DefDef =>
59
53
inContext(localCtx(tree)) {
60
54
cpy.DefDef (tree)(
Original file line number Diff line number Diff line change @@ -1195,6 +1195,13 @@ object tpd extends Trees.Instance[Type] with TypedTreeInfo {
1195
1195
* - imports are reflected in the contexts of subsequent statements
1196
1196
*/
1197
1197
class TreeMapWithPreciseStatContexts (cpy : TreeCopier = tpd.cpy) extends TreeMap (cpy):
1198
+ override def transform (tree : Tree )(using Context ): Tree = tree match
1199
+ case Block (stats, expr) =>
1200
+ val stats1 = transformStats(stats :+ expr, ctx.owner)
1201
+ cpy.Block (tree)(stats1.init, stats1.last)
1202
+ case _ =>
1203
+ super .transform(tree)
1204
+
1198
1205
override def transformStats (trees : List [Tree ], exprOwner : Symbol )(using Context ): List [Tree ] =
1199
1206
trees.mapStatements(exprOwner, transform(_))
1200
1207
Original file line number Diff line number Diff line change @@ -296,9 +296,8 @@ class MegaPhase(val miniPhases: Array[MiniPhase]) extends Phase {
296
296
}
297
297
case tree : Block =>
298
298
inContext(prepBlock(tree, start)(using outerCtx)) {
299
- val stats = transformStats(tree.stats, ctx.owner, start)
300
- val expr = transformTree(tree.expr, start)
301
- goBlock(cpy.Block (tree)(stats, expr), start)
299
+ val stats1 = transformStats(tree.stats :+ tree.expr, ctx.owner, start)
300
+ goBlock(cpy.Block (tree)(stats1.init, stats1.last), start)
302
301
}
303
302
case tree : TypeApply =>
304
303
inContext(prepTypeApply(tree, start)(using outerCtx)) {
Original file line number Diff line number Diff line change
1
+ import java .nio .file .FileSystems
2
+ import java .util .ArrayList
3
+
4
+ def directorySeparator : String =
5
+ import scala .language .unsafeNulls
6
+ FileSystems .getDefault().getSeparator()
7
+
8
+ def getFirstOfFirst (xs : ArrayList [ArrayList [ArrayList [String ]]]): String =
9
+ import scala .language .unsafeNulls
10
+ xs.get(0 ).get(0 ).get(0 )
You can’t perform that action at this time.
0 commit comments