diff options
Diffstat (limited to 'src/repl.cpp')
-rw-r--r-- | src/repl.cpp | 10 |
1 files changed, 6 insertions, 4 deletions
diff --git a/src/repl.cpp b/src/repl.cpp index d2b8270..5850e66 100644 --- a/src/repl.cpp +++ b/src/repl.cpp @@ -147,10 +147,11 @@ eval(CEnv& cenv, const string& name, istream& is, bool execute) } const AType* type = cenv.type(exprs.back()); - + const AType* fnT = tup<const AType>(cursor, cenv.tenv.Fn, new AType(cursor), type, 0); + // Create function for top-level of program - f = cenv.engine()->startFunction(cenv, "main", new ATuple(cursor), type, ATuple(cursor)); - + f = cenv.engine()->startFunction(cenv, "main", new ATuple(cursor), fnT); + // Compile expressions (other than function definitions) into it for (list<AST*>::const_iterator i = exprs.begin(); i != exprs.end(); ++i) val = (*i)->compile(cenv); @@ -188,10 +189,11 @@ repl(CEnv& cenv) Code lifted; ast = ast->lift(cenv, lifted); const AType* type = cenv.type(ast); + const AType* fnT = tup<const AType>(cursor, cenv.tenv.Fn, new AType(cursor), type, 0); CFunc f = NULL; try { // Create function for this repl loop - f = cenv.engine()->startFunction(cenv, replFnName, new ATuple(cursor), type, ATuple(cursor)); + f = cenv.engine()->startFunction(cenv, replFnName, new ATuple(cursor), fnT); cenv.engine()->finishFunction(cenv, f, ast->compile(cenv)); callPrintCollect(cenv, f, ast, type, true); if (cenv.args.find("-d") != cenv.args.end()) |