@@ -74,11 +74,17 @@ class ReplDriver(settings: Array[String],
7474 val rootCtx = initCtx.fresh.addMode(Mode .ReadPositions | Mode .Interactive )
7575 rootCtx.setSetting(rootCtx.settings.YcookComments , true )
7676 rootCtx.setSetting(rootCtx.settings.YreadComments , true )
77+ setupRootCtx(settings, rootCtx)
78+ }
79+
80+ private def setupRootCtx (settings : Array [String ], rootCtx : Context ) = {
7781 setup(settings, rootCtx) match
78- case Some ((files, ictx)) =>
82+ case Some ((files, ictx)) => inContext(ictx) {
7983 shouldStart = true
80- ictx.base.initialize()(using ictx)
84+ if files.nonEmpty then out.println(i " Ignoring spurious arguments: $files%, % " )
85+ ictx.base.initialize()
8186 ictx
87+ }
8288 case None =>
8389 shouldStart = false
8490 rootCtx
@@ -423,14 +429,7 @@ class ReplDriver(settings: Array[String],
423429 out.println(s " ${s.name} = ${if s.value == " " then " \"\" " else s.value}" )
424430 state
425431 case _ =>
426- setup(tokenize(arg).toArray, rootCtx) match
427- case Some ((files, ictx)) =>
428- inContext(ictx) {
429- if files.nonEmpty then out.println(i " Ignoring spurious arguments: $files%, % " )
430- ictx.base.initialize()(using ictx)
431- rootCtx = ictx
432- }
433- case _ =>
432+ rootCtx = setupRootCtx(tokenize(arg).toArray, rootCtx)
434433 state.copy(context = rootCtx)
435434
436435 case Quit =>
0 commit comments