diff options
Diffstat (limited to 'src/compile.cpp')
-rw-r--r-- | src/compile.cpp | 17 |
1 files changed, 6 insertions, 11 deletions
diff --git a/src/compile.cpp b/src/compile.cpp index 244fcc6..fd5baff 100644 --- a/src/compile.cpp +++ b/src/compile.cpp @@ -54,23 +54,18 @@ compile_literal_symbol(CEnv& cenv, const ASymbol* sym) throw() } static CVal -compile_type(CEnv& cenv, const AST* type) throw() -{ - return compile_literal_symbol(cenv, type->as_tuple()->fst()->as_symbol()); -} - -static CVal compile_cons(CEnv& cenv, const ATuple* cons) throw() { - ATuple* type = new ATuple(cons->fst()->as_symbol(), NULL, Cursor()); - List tlist(type); - vector<CVal> fields; + const ASymbol* tname = cons->fst()->as_symbol(); + ATuple* type = new ATuple(tname, NULL, Cursor()); + List tlist(type); + vector<CVal> fields; for (ATuple::const_iterator i = cons->iter_at(1); i != cons->end(); ++i) { - assert(cenv.type(*i)); tlist.push_back(cenv.type(*i)); fields.push_back(resp_compile(cenv, *i)); } - return cenv.engine()->compileCons(cenv, type, compile_type(cenv, type), fields); + return cenv.engine()->compileCons( + cenv, type, compile_literal_symbol(cenv, tname), fields); } static CVal |