aboutsummaryrefslogtreecommitdiffstats
path: root/src/compile.cpp
diff options
context:
space:
mode:
authorDavid Robillard <d@drobilla.net>2010-12-02 19:36:27 +0000
committerDavid Robillard <d@drobilla.net>2010-12-02 19:36:27 +0000
commit58daa5a8568ee0cc780bad8575e61447be64c77d (patch)
treec01db2cc46346282926a73c820eed113805529ac /src/compile.cpp
parent1b61928f542f1c54ac67791f382b20b39927eac5 (diff)
downloadresp-58daa5a8568ee0cc780bad8575e61447be64c77d.tar.gz
resp-58daa5a8568ee0cc780bad8575e61447be64c77d.tar.bz2
resp-58daa5a8568ee0cc780bad8575e61447be64c77d.zip
Remove ACall subclasses.
git-svn-id: http://svn.drobilla.net/resp/resp@282 ad02d1e2-f140-0410-9f75-f8b11f17cedd
Diffstat (limited to 'src/compile.cpp')
-rw-r--r--src/compile.cpp12
1 files changed, 5 insertions, 7 deletions
diff --git a/src/compile.cpp b/src/compile.cpp
index 9f9168a..cf777f8 100644
--- a/src/compile.cpp
+++ b/src/compile.cpp
@@ -118,7 +118,7 @@ compile_cons(CEnv& cenv, const ACall* cons) throw()
AType* type = new AType(const_cast<ASymbol*>(cons->head()->as<const ASymbol*>()), NULL, Cursor());
TList tlist(type);
vector<CVal> fields;
- for (ACons::const_iterator i = cons->iter_at(1); i != cons->end(); ++i) {
+ for (ATuple::const_iterator i = cons->iter_at(1); i != cons->end(); ++i) {
tlist.push_back(const_cast<AType*>(cenv.type(*i)));
fields.push_back(resp_compile(cenv, *i));
}
@@ -159,10 +159,6 @@ resp_compile(CEnv& cenv, const AST* ast) throw()
if (fn)
return compile_fn(cenv, fn);
- const APrimitive* prim = ast->to<const APrimitive*>();
- if (prim)
- return cenv.engine()->compilePrimitive(cenv, prim);
-
const AType* type = ast->to<const AType*>();
if (type)
return compile_type(cenv, type);
@@ -171,7 +167,9 @@ resp_compile(CEnv& cenv, const AST* ast) throw()
if (call) {
const ASymbol* const sym = call->head()->to<const ASymbol*>();
const std::string form = sym ? sym->cppstr : "";
- if (form == "def")
+ if (is_primitive(cenv.penv, call))
+ return cenv.engine()->compilePrimitive(cenv, ast->as<const ACall*>());
+ else if (form == "def")
return compile_def(cenv, call);
else if (form == "if")
return cenv.engine()->compileIf(cenv, call);
@@ -189,7 +187,7 @@ resp_compile(CEnv& cenv, const AST* ast) throw()
return compile_call(cenv, call);
}
- cenv.err << "Attempt to compile unknown type" << endl;
+ cenv.err << "Attempt to compile unknown type: " << ast << endl;
assert(false);
return NULL;
}