diff options
Diffstat (limited to 'src/simplify.cpp')
-rw-r--r-- | src/simplify.cpp | 39 |
1 files changed, 2 insertions, 37 deletions
diff --git a/src/simplify.cpp b/src/simplify.cpp index f1b1bec..34c1ef0 100644 --- a/src/simplify.cpp +++ b/src/simplify.cpp @@ -139,39 +139,6 @@ simplify_list(CEnv& cenv, Code& code, const ATuple* call) throw() return copy; } -static const AST* -simplify_let(CEnv& cenv, Code& code, const ATuple* call) throw() -{ - const ATuple* vars = call->list_ref(1)->to_tuple(); - - List fn(Cursor(), cenv.penv.sym("lambda"), NULL); - - List fnProt; - List fnArgs; - List fnProtT; - for (ATuple::const_iterator i = vars->begin(); i != vars->end();) { - const ASymbol* sym = (*i++)->to_symbol(); - const AST* val = (*i++); - fnProt.push_back(sym); - fnArgs.push_back(resp_simplify(cenv, code, val)); - fnProtT.push_back(cenv.type(val)); - } - - fn.push_back(fnProt.head); - fn.push_back(resp_simplify(cenv, code, call->list_ref(2))); - - List fnT; - fnT.push_back(cenv.tenv.Fn); - fnT.push_back(fnProtT); - fnT.push_back(cenv.type(call->list_ref(2))); - cenv.setType(fn, fnT); - - ATuple* copy = new ATuple(fn, fnArgs, call->loc); - cenv.setTypeSameAs(copy, call); - - return copy; -} - static inline const AST* quote(CEnv& cenv, const AST* ast); @@ -219,18 +186,16 @@ const AST* resp_simplify(CEnv& cenv, Code& code, const AST* ast) throw() { const ATuple* const list = ast->to_tuple(); - if (!list) + if (!list || !list->fst()) return ast; - const ASymbol* const sym = list->fst()->to_symbol(); + const ASymbol* const sym = list->fst() ? list->fst()->to_symbol() : 0; const std::string form = sym ? sym->sym() : ""; if (form == "match") return simplify_match(cenv, code, list); else if (form == "if") return simplify_if(cenv, code, list); - else if (form == "let") - return simplify_let(cenv, code, list); else if (form == "quote") return simplify_quote(cenv, code, list); else |