Skip to content

Commit 0d7866a

Browse files
committed
working but state lost
1 parent 201cfed commit 0d7866a

File tree

1 file changed

+5
-9
lines changed

1 file changed

+5
-9
lines changed

compiler/src/dotty/tools/repl/ReplDriver.scala

Lines changed: 5 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -546,18 +546,14 @@ class ReplDriver(settings: Array[String],
546546
// println(s"classPath after add = ${state.context.platform.classPath(using state.context).asClassPathString}")
547547

548548
// recreate initial context
549-
rootCtx = setupRootCtx(Array(), rootCtx.fresh.setSetting(rootCtx.settings.classpath, newCP))
549+
resetToInitial(List("-classpath", newCP))
550+
// rootCtx = setupRootCtx(Array(), rootCtx.fresh.setSetting(rootCtx.settings.classpath, newCP))
550551
val s = state.copy(context = rootCtx)
551-
println(s"after setupRootCtx classPath = ${s.context.platform.classPath(using s.context).asClassPathString}")
552-
553552

554553
// new class loader
555-
// val newClassPath = state.context.platform.classPath(using state.context).asURLs :+ f.toURI.toURL
556-
// val oldCL = rendering.classLoader()(using state.context)
557-
// val newCL = fromURLsParallelCapable(newClassPath, oldCL)
558-
// println(s"new CL class path = ${newCL.getURLs.toList}")
559-
// println(s"\nclass name = ${cpCP.className}")
560-
// rendering.myClassLoader = new AbstractFileClassLoader(state.context.settings.outputDir.default, newCL)
554+
val oldCL = rendering.classLoader()(using state.context)
555+
val newCL = fromURLsParallelCapable(s.context.platform.classPath(using s.context).asURLs, oldCL)
556+
rendering.myClassLoader = new AbstractFileClassLoader(state.context.settings.outputDir.default, newCL)
561557
// out.println(s"Added '$path' to classpath.")
562558
s
563559
case TypeOf(expr) =>

0 commit comments

Comments
 (0)