From 94b68f0c020653b812e13e054988e2d2c810ce59 Mon Sep 17 00:00:00 2001 From: David Robillard Date: Sun, 15 May 2011 21:36:34 +0000 Subject: Simplify compile_cons. git-svn-id: http://svn.drobilla.net/resp/trunk@429 ad02d1e2-f140-0410-9f75-f8b11f17cedd --- src/compile.cpp | 17 ++++++----------- 1 file changed, 6 insertions(+), 11 deletions(-) (limited to 'src/compile.cpp') diff --git a/src/compile.cpp b/src/compile.cpp index 244fcc6..fd5baff 100644 --- a/src/compile.cpp +++ b/src/compile.cpp @@ -53,24 +53,19 @@ 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 fields; + const ASymbol* tname = cons->fst()->as_symbol(); + ATuple* type = new ATuple(tname, NULL, Cursor()); + List tlist(type); + vector 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 -- cgit v1.2.1