aboutsummaryrefslogtreecommitdiffstats
path: root/src/constrain.cpp
diff options
context:
space:
mode:
authorDavid Robillard <d@drobilla.net>2012-12-25 08:35:43 +0000
committerDavid Robillard <d@drobilla.net>2012-12-25 08:35:43 +0000
commit77d27b3495bfa98c5e13707903e4f885e8521ab6 (patch)
treeb2cadb927fd0ab8732001fc77a580f1dffcd0744 /src/constrain.cpp
parent12314c754187ae246bc38aceb827bf51d1669d73 (diff)
downloadresp-77d27b3495bfa98c5e13707903e4f885e8521ab6.tar.gz
resp-77d27b3495bfa98c5e13707903e4f885e8521ab6.tar.bz2
resp-77d27b3495bfa98c5e13707903e4f885e8521ab6.zip
Support multiple ellipses in macros.
Support lambda expressions with empty argument lists. git-svn-id: http://svn.drobilla.net/resp/trunk@445 ad02d1e2-f140-0410-9f75-f8b11f17cedd
Diffstat (limited to 'src/constrain.cpp')
-rw-r--r--src/constrain.cpp12
1 files changed, 10 insertions, 2 deletions
diff --git a/src/constrain.cpp b/src/constrain.cpp
index 2a3c8fe..3655396 100644
--- a/src/constrain.cpp
+++ b/src/constrain.cpp
@@ -164,8 +164,13 @@ constrain_fn(TEnv& tenv, Constraints& c, const ATuple* call) throw(Error)
frame.push_back(make_pair(sym->sym(), tvar));
protT.push_back(tvar);
}
- protT.head->loc = call->loc;
+ if (!protT.head) {
+ protT.head = new ATuple(NULL, NULL, call->loc);
+ } else {
+ protT.head->loc = call->loc;
+ }
+
ATuple::const_iterator i = call->iter_at(1);
c.constrain(tenv, *i, protT);
@@ -352,7 +357,8 @@ constrain_call(TEnv& tenv, Constraints& c, const ATuple* call) throw(Error)
List argsT;
for (ATuple::const_iterator i = call->iter_at(1); i != call->end(); ++i)
argsT.push_back(tenv.var(*i));
- argsT.head->loc = call->loc;
+ if (argsT.head)
+ argsT.head->loc = call->loc;
c.constrain(tenv, head, tup(head->loc, tenv.Fn, argsT.head, retT, 0));
c.constrain(tenv, call, retT);
}
@@ -473,5 +479,7 @@ resp_constrain(TEnv& tenv, Constraints& c, const AST* ast) throw(Error)
case T_TUPLE:
constrain_list(tenv, c, ast->as_tuple());
break;
+ case T_ELLIPSIS:
+ throw Error(ast->loc, "ellipsis present after expand stage");
}
}