File tree 1 file changed +7
-1
lines changed
compiler/src/dotty/tools/dotc/interactive 1 file changed +7
-1
lines changed Original file line number Diff line number Diff line change @@ -50,8 +50,11 @@ class InteractiveDriver(settings: List[String]) extends Driver {
50
50
override def default (key : URI ) = Nil
51
51
}
52
52
53
+ private val myCompilationUnits = new mutable.LinkedHashMap [URI , CompilationUnit ]
54
+
53
55
def openedFiles : Map [URI , SourceFile ] = myOpenedFiles
54
56
def openedTrees : Map [URI , List [SourceTree ]] = myOpenedTrees
57
+ def compilationUnits : Map [URI , CompilationUnit ] = myCompilationUnits
55
58
56
59
def allTrees (implicit ctx : Context ): List [SourceTree ] = allTreesContaining(" " )
57
60
@@ -229,9 +232,11 @@ class InteractiveDriver(settings: List[String]) extends Driver {
229
232
230
233
run.compileSources(List (source))
231
234
run.printSummary()
232
- val t = ctx.run.units.head.tpdTree
235
+ val unit = ctx.run.units.head
236
+ val t = unit.tpdTree
233
237
cleanup(t)
234
238
myOpenedTrees(uri) = topLevelClassTrees(t, source)
239
+ myCompilationUnits(uri) = unit
235
240
236
241
reporter.removeBufferedMessages
237
242
}
@@ -246,6 +251,7 @@ class InteractiveDriver(settings: List[String]) extends Driver {
246
251
def close (uri : URI ): Unit = {
247
252
myOpenedFiles.remove(uri)
248
253
myOpenedTrees.remove(uri)
254
+ myCompilationUnits.remove(uri)
249
255
}
250
256
}
251
257
You can’t perform that action at this time.
0 commit comments