@@ -537,21 +537,23 @@ class ReplDriver(settings: Array[String],
537
537
val existingClass = entries.filter(_.ext.isClass).map(classNameOf).find(alreadyDefined)
538
538
if (existingClass.nonEmpty)
539
539
out.println(s " The path ' $f' cannot be loaded, it contains a classfile that already exists on the classpath: ${existingClass.get}" )
540
+ state
540
541
else
541
- // val cp = state.context.platform.classPath(using state.context).asClassPathString
542
+ val cp = state.context.platform.classPath(using state.context).asClassPathString
542
543
// println(s"CURRENT CP STRING: $cp")
543
- // val newCP = s"$cp${JFile.pathSeparator}$path"
544
- // println(s"UPDATED CP: $newCP")
544
+ val newCP = s " $cp${JFile .pathSeparator}$path"
545
+ println(s " UPDATED CP: $newCP" )
545
546
546
547
// add to compiler class path
547
- println(s " INIT state classPath = ${state.context.platform.classPath(using state.context).asClassPathString}" )
548
- val cpCP = ClassPathFactory .newClassPath(jarFile)(using state.context)
549
- state.context.platform.addToClassPath(cpCP)
550
- println(s " classPath after add = ${state.context.platform.classPath(using state.context).asClassPathString}" )
548
+ // println(s"INIT state classPath = ${state.context.platform.classPath(using state.context).asClassPathString}")
549
+ // val cpCP = ClassPathFactory.newClassPath(jarFile)(using state.context)
550
+ // state.context.platform.addToClassPath(cpCP)
551
+ // println(s"classPath after add = ${state.context.platform.classPath(using state.context).asClassPathString}")
551
552
552
- // create initial context
553
- rootCtx = setupRootCtx(Array (), rootCtx)
554
- state.copy(context = rootCtx)
553
+ // recreate initial context
554
+ rootCtx = setupRootCtx(Array (), rootCtx.fresh.setSetting(rootCtx.settings.classpath, newCP))
555
+ val s = state.copy(context = rootCtx)
556
+ println(s " after setupRootCtx classPath = ${s.context.platform.classPath(using s.context).asClassPathString}" )
555
557
556
558
557
559
// new class loader
@@ -562,13 +564,11 @@ class ReplDriver(settings: Array[String],
562
564
// println(s"\nclass name = ${cpCP.className}")
563
565
// rendering.myClassLoader = new AbstractFileClassLoader(state.context.settings.outputDir.default, newCL)
564
566
// out.println(s"Added '$path' to classpath.")
565
- println(s " after setupRootCtx classPath = ${state.context.platform.classPath(using state.context).asClassPathString}" )
566
- state
567
+ s
567
568
568
569
case KindOf (expr) =>
569
570
out.println(s """ The :kind command is not currently supported. """ )
570
571
state
571
-
572
572
case TypeOf (expr) =>
573
573
expr match {
574
574
case " " => out.println(s " :type <expression> " )
0 commit comments