File tree Expand file tree Collapse file tree 1 file changed +7
-1
lines changed
compiler/src/dotty/tools/dotc/interactive Expand file tree Collapse file tree 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 {
5050 override def default (key : URI ) = Nil
5151 }
5252
53+ private val myCompilationUnits = new mutable.LinkedHashMap [URI , CompilationUnit ]
54+
5355 def openedFiles : Map [URI , SourceFile ] = myOpenedFiles
5456 def openedTrees : Map [URI , List [SourceTree ]] = myOpenedTrees
57+ def compilationUnits : Map [URI , CompilationUnit ] = myCompilationUnits
5558
5659 def allTrees (implicit ctx : Context ): List [SourceTree ] = allTreesContaining(" " )
5760
@@ -229,9 +232,11 @@ class InteractiveDriver(settings: List[String]) extends Driver {
229232
230233 run.compileSources(List (source))
231234 run.printSummary()
232- val t = ctx.run.units.head.tpdTree
235+ val unit = ctx.run.units.head
236+ val t = unit.tpdTree
233237 cleanup(t)
234238 myOpenedTrees(uri) = topLevelClassTrees(t, source)
239+ myCompilationUnits(uri) = unit
235240
236241 reporter.removeBufferedMessages
237242 }
@@ -246,6 +251,7 @@ class InteractiveDriver(settings: List[String]) extends Driver {
246251 def close (uri : URI ): Unit = {
247252 myOpenedFiles.remove(uri)
248253 myOpenedTrees.remove(uri)
254+ myCompilationUnits.remove(uri)
249255 }
250256}
251257
You can’t perform that action at this time.
0 commit comments