From a2021fceed6810a5c9f2f14632fc40a5c122cf0e Mon Sep 17 00:00:00 2001 From: David Robillard Date: Thu, 2 Dec 2010 18:08:44 +0000 Subject: Remove use of ACall type hierarchy from lift phase. git-svn-id: http://svn.drobilla.net/resp/resp@280 ad02d1e2-f140-0410-9f75-f8b11f17cedd --- src/lift.cpp | 52 ++++++++++++++++++++-------------------------------- 1 file changed, 20 insertions(+), 32 deletions(-) (limited to 'src/lift.cpp') diff --git a/src/lift.cpp b/src/lift.cpp index 29a25fe..aea8b0d 100644 --- a/src/lift.cpp +++ b/src/lift.cpp @@ -178,7 +178,7 @@ lift_call(CEnv& cenv, Code& code, ACall* call) throw() } static AST* -lift_def(CEnv& cenv, Code& code, ADef* def) throw() +lift_def(CEnv& cenv, Code& code, ACall* def) throw() { // Define stub first for recursion const ASymbol* const sym = def->list_ref(1)->as(); @@ -229,45 +229,33 @@ resp_lift(CEnv& cenv, Code& code, AST* ast) throw() if (sym) return lift_symbol(cenv, code, sym); - ADef* const def = ast->to(); - if (def) - return lift_def(cenv, code, def); - AFn* const fn = ast->to(); if (fn) return lift_fn(cenv, code, fn); - AIf* const aif = ast->to(); - if (aif) - return lift_builtin_call(cenv, code, aif); - - ACons* const cons = ast->to(); - if (cons) - return lift_builtin_call(cenv, code, cons); - - ADot* const dot = ast->to(); - if (dot) - return lift_builtin_call(cenv, code, dot); - - AQuote* const quote = ast->to(); - if (quote) - return lift_builtin_call(cenv, code, quote); - - AMatch* const match = ast->to(); - if (match) - return match; // FIXME - APrimitive* const prim = ast->to(); if (prim) return lift_builtin_call(cenv, code, prim); - ADefType* const defType = ast->to(); - if (defType) - return defType; - ACall* const call = ast->to(); - if (call) - return lift_call(cenv, code, call); - + if (call) { + const ASymbol* const sym = call->head()->to(); + const std::string form = sym ? sym->cppstr : ""; + if (form == "def") + return lift_def(cenv, code, call); + else if (form == "if") + return lift_builtin_call(cenv, code, call); + else if (form == "cons" || isupper(form[0])) + return lift_builtin_call(cenv, code, call); + else if (form == ".") + return lift_builtin_call(cenv, code, call); + else if (form == "quote") + return lift_builtin_call(cenv, code, call); + else if (form == "match" || form == "def-type") + return call; // FIXME + else + return lift_call(cenv, code, call); + } + return ast; } -- cgit v1.2.1