diff options
Diffstat (limited to 'src/repl.cpp')
-rw-r--r-- | src/repl.cpp | 12 |
1 files changed, 8 insertions, 4 deletions
diff --git a/src/repl.cpp b/src/repl.cpp index fc7b6ec..24b0acf 100644 --- a/src/repl.cpp +++ b/src/repl.cpp @@ -28,7 +28,7 @@ using namespace std; /// Compile and evaluate code from @a is int -eval(CEnv& cenv, const string& name, istream& is) +eval(CEnv& cenv, const string& name, istream& is, bool execute) { AST* result = NULL; AType* resultType = NULL; @@ -74,11 +74,15 @@ eval(CEnv& cenv, const string& name, istream& is) for (list< pair<AST*, AST*> >::const_iterator i = exprs.begin(); i != exprs.end(); ++i) val = cenv.compile(i->second); - // Finish and call it + // Finish compilation cenv.engine()->finishFunction(cenv, f, resultType, val); - cenv.out << cenv.engine()->call(cenv, f, resultType); + + // Call it + if (execute) + cenv.out << cenv.engine()->call(cenv, f, resultType); } - cenv.out << " : " << resultType << endl; + if (execute) + cenv.out << " : " << resultType << endl; Object::pool.collect(Object::pool.roots()); |