aboutsummaryrefslogtreecommitdiffstats
path: root/src/llvm.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/llvm.cpp')
-rw-r--r--src/llvm.cpp21
1 files changed, 12 insertions, 9 deletions
diff --git a/src/llvm.cpp b/src/llvm.cpp
index 39cf2d0..0f13f76 100644
--- a/src/llvm.cpp
+++ b/src/llvm.cpp
@@ -109,9 +109,9 @@ struct LLVMEngine : public Engine {
Function::LinkageTypes linkage = Function::ExternalLinkage;
vector<const Type*> cprot;
- for (size_t i = 0; i < argsT.size(); ++i) {
- AType* at = argsT.at(i)->as<AType*>();
- THROW_IF(!llType(at), Cursor(), string("parameter has non-concrete type ")
+ FOREACH(ATuple::const_iterator, i, argsT) {
+ AType* at = (*i)->as<AType*>();
+ THROW_IF(!llType(at), Cursor(), string("non-concrete parameter :: ")
+ at->str())
cprot.push_back(llType(at));
}
@@ -263,18 +263,21 @@ AFn::liftCall(CEnv& cenv, const AType& argsT)
if (!genericType->concrete()) {
// Build substitution to apply to generic type
assert(argsT.size() == prot()->size());
- ATuple* genericProtT = gt->second->at(1)->as<ATuple*>();
- for (size_t i = 0; i < argsT.size(); ++i) {
- const AType* genericArgT = genericProtT->at(i)->to<const AType*>();
- AType* callArgT = argsT.at(i)->to<AType*>();
+ const ATuple* genericProtT = gt->second->at(1)->as<const ATuple*>();
+ ATuple::const_iterator g = genericProtT->begin();
+ AType::const_iterator a = argsT.begin();
+ for (; a != argsT.end(); ++a, ++g) {
+ assert(g != genericProtT->end());
+ const AType* genericArgT = (*g)->to<const AType*>();
+ AType* callArgT = (*a)->to<AType*>();
assert(genericArgT);
assert(callArgT);
if (callArgT->kind == AType::EXPR) {
assert(genericArgT->kind == AType::EXPR);
assert(callArgT->size() == genericArgT->size());
for (size_t i = 0; i < callArgT->size(); ++i) {
- AType* gT = genericArgT->at(i)->to<AType*>();
- AType* aT = callArgT->at(i)->to<AType*>();
+ const AType* gT = genericArgT->at(i)->to<const AType*>();
+ AType* aT = callArgT->at(i)->to<AType*>();
if (gT && aT)
argsSubst.add(gT, aT);
}