diff options
author | David Robillard <d@drobilla.net> | 2011-05-15 21:36:34 +0000 |
---|---|---|
committer | David Robillard <d@drobilla.net> | 2011-05-15 21:36:34 +0000 |
commit | 94b68f0c020653b812e13e054988e2d2c810ce59 (patch) | |
tree | 0a92ebade867e308d74dc4f6d5fbc0e8aa87b58b /src/compile.cpp | |
parent | 4b70c05fed4ece152eedffc33ed53cb28b74df39 (diff) | |
download | resp-94b68f0c020653b812e13e054988e2d2c810ce59.tar.gz resp-94b68f0c020653b812e13e054988e2d2c810ce59.tar.bz2 resp-94b68f0c020653b812e13e054988e2d2c810ce59.zip |
Simplify compile_cons.
git-svn-id: http://svn.drobilla.net/resp/trunk@429 ad02d1e2-f140-0410-9f75-f8b11f17cedd
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 |