@@ -114,7 +114,6 @@ class ReplCompiler extends Compiler {
114114
115115 val tmpl = Template (emptyConstructor, Nil , EmptyValDef , defs.stats)
116116 val module = ModuleDef (objectName(defs.state), tmpl)
117- .withMods(Modifiers (Module | Final ))
118117 .withPos(Position (0 , defs.stats.last.pos.end))
119118
120119 PackageDef (Ident (nme.EMPTY_PACKAGE ), List (module))
@@ -156,22 +155,15 @@ class ReplCompiler extends Compiler {
156155 final def typeCheck (expr : String , errorsAllowed : Boolean = false )(implicit state : State ): Result [tpd.ValDef ] = {
157156
158157 def wrapped (expr : String , sourceFile : SourceFile , state : State )(implicit ctx : Context ): Result [untpd.PackageDef ] = {
159- def wrap (trees : Seq [untpd.Tree ]): untpd.PackageDef = {
158+ def wrap (trees : List [untpd.Tree ]): untpd.PackageDef = {
160159 import untpd ._
161160
162- val valdef =
163- ValDef (" expr" .toTermName, TypeTree (), Block (trees.toList, untpd.unitLiteral))
164-
165- val tmpl = Template (emptyConstructor,
166- List (Ident (tpnme.Any )),
167- EmptyValDef ,
168- state.imports :+ valdef)
169-
170- PackageDef (Ident (nme.EMPTY_PACKAGE ),
171- TypeDef (" EvaluateExpr" .toTypeName, tmpl)
172- .withMods(Modifiers (Final ))
173- .withPos(Position (0 , expr.length)) :: Nil
174- )
161+ val valdef = ValDef (" expr" .toTermName, TypeTree (), Block (trees, unitLiteral))
162+ val tmpl = Template (emptyConstructor, Nil , EmptyValDef , state.imports :+ valdef)
163+ val wrapper = TypeDef (" $wrapper" .toTypeName, tmpl)
164+ .withMods(Modifiers (Final ))
165+ .withPos(Position (0 , expr.length))
166+ PackageDef (Ident (nme.EMPTY_PACKAGE ), List (wrapper))
175167 }
176168
177169 ParseResult (expr) match {
0 commit comments