@@ -114,7 +114,6 @@ class ReplCompiler extends Compiler {
114
114
115
115
val tmpl = Template (emptyConstructor, Nil , EmptyValDef , defs.stats)
116
116
val module = ModuleDef (objectName(defs.state), tmpl)
117
- .withMods(Modifiers (Module | Final ))
118
117
.withPos(Position (0 , defs.stats.last.pos.end))
119
118
120
119
PackageDef (Ident (nme.EMPTY_PACKAGE ), List (module))
@@ -156,22 +155,15 @@ class ReplCompiler extends Compiler {
156
155
final def typeCheck (expr : String , errorsAllowed : Boolean = false )(implicit state : State ): Result [tpd.ValDef ] = {
157
156
158
157
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 = {
160
159
import untpd ._
161
160
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))
175
167
}
176
168
177
169
ParseResult (expr) match {
0 commit comments