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