From 22e329617866a6580ccff5636f148d72603fa8fc Mon Sep 17 00:00:00 2001 From: David Robillard Date: Fri, 10 Dec 2010 04:24:20 +0000 Subject: Move simplification from lift stage to a new (post-typing) simplify stage. git-svn-id: http://svn.drobilla.net/resp/resp@344 ad02d1e2-f140-0410-9f75-f8b11f17cedd --- src/repl.cpp | 17 +++++++++++++++-- 1 file changed, 15 insertions(+), 2 deletions(-) (limited to 'src/repl.cpp') diff --git a/src/repl.cpp b/src/repl.cpp index 52d35c5..063f1e7 100644 --- a/src/repl.cpp +++ b/src/repl.cpp @@ -100,12 +100,26 @@ eval(CEnv& cenv, Cursor& cursor, istream& is, bool execute) return 0; } + // Simplify all expressions + Code simplified; + for (Parsed::const_iterator i = parsed.begin(); i != parsed.end(); ++i) { + const AST* l = resp_simplify(cenv, *i); + if (l) + simplified.push_back(l); + } + + if (cenv.args.find("-R") != cenv.args.end()) { + for (Code::const_iterator i = simplified.begin(); i != simplified.end(); ++i) + pprint(cout, *i, &cenv, (cenv.args.find("-a") != cenv.args.end())); + return 0; + } + CVal val = NULL; CFunc f = NULL; // Lift all expressions Code lifted; - for (Parsed::const_iterator i = parsed.begin(); i != parsed.end(); ++i) { + for (Parsed::const_iterator i = simplified.begin(); i != simplified.end(); ++i) { const AST* l = resp_lift(cenv, lifted, *i); if (l) lifted.push_back(l); @@ -114,7 +128,6 @@ eval(CEnv& cenv, Cursor& cursor, istream& is, bool execute) if (cenv.args.find("-L") != cenv.args.end()) { for (Code::const_iterator i = lifted.begin(); i != lifted.end(); ++i) pprint(cout, *i, &cenv, (cenv.args.find("-a") != cenv.args.end())); - return 0; } -- cgit v1.2.1