@@ -38,34 +38,36 @@ class ReplCompiler extends Compiler {
38
38
List (new PostTyper ),
39
39
)
40
40
41
- def newRun (initCtx : Context , state : State ): Run = new Run ( this , initCtx) {
42
-
43
- /** Import previous runs and user defined imports */
44
- override protected def rootContext (using Context ): Context = {
45
- def importContext (imp : tpd.Import )(using Context ) =
46
- ctx.importContext(imp, imp.symbol)
47
-
48
- def importPreviousRun (id : Int )(using Context ) = {
49
- // we first import the wrapper object id
50
- val path = nme.REPL_PACKAGE ++ " ." ++ objectNames(id)
51
- val ctx0 = ctx.fresh
52
- .setNewScope
53
- .withRootImports(RootRef (() => requiredModuleRef(path)) :: Nil )
54
-
55
- // then its user defined imports
56
- val imports = state.imports.getOrElse(id, Nil )
57
- if imports.isEmpty then ctx0
58
- else imports.foldLeft(ctx0.fresh.setNewScope)((ctx, imp) =>
59
- importContext(imp)(using ctx))
60
- }
41
+ def newRun (initCtx : Context , state : State ): Run =
42
+ val run = new Run ( this , initCtx) {
43
+ /** Import previous runs and user defined imports */
44
+ override protected def rootContext (using Context ): Context = {
45
+ def importContext (imp : tpd.Import )(using Context ) =
46
+ ctx.importContext(imp, imp.symbol)
47
+
48
+ def importPreviousRun (id : Int )(using Context ) = {
49
+ // we first import the wrapper object id
50
+ val path = nme.REPL_PACKAGE ++ " ." ++ objectNames(id)
51
+ val ctx0 = ctx.fresh
52
+ .setNewScope
53
+ .withRootImports(RootRef (() => requiredModuleRef(path)) :: Nil )
54
+
55
+ // then its user defined imports
56
+ val imports = state.imports.getOrElse(id, Nil )
57
+ if imports.isEmpty then ctx0
58
+ else imports.foldLeft(ctx0.fresh.setNewScope)((ctx, imp) =>
59
+ importContext(imp)(using ctx))
60
+ }
61
61
62
- val rootCtx = super .rootContext
63
- .withRootImports // default root imports
64
- .withRootImports(RootRef (() => defn.EmptyPackageVal .termRef) :: Nil )
65
- (1 to state.objectIndex).foldLeft(rootCtx)((ctx, id) =>
66
- importPreviousRun(id)(using ctx))
62
+ val rootCtx = super .rootContext
63
+ .withRootImports // default root imports
64
+ .withRootImports(RootRef (() => defn.EmptyPackageVal .termRef) :: Nil )
65
+ (1 to state.objectIndex).foldLeft(rootCtx)((ctx, id) =>
66
+ importPreviousRun(id)(using ctx))
67
+ }
67
68
}
68
- }
69
+ run.suppressions.initSuspendedMessages(state.context.run)
70
+ run
69
71
70
72
private val objectNames = mutable.Map .empty[Int , TermName ]
71
73
0 commit comments