aboutsummaryrefslogtreecommitdiffstats
path: root/src/constrain.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/constrain.cpp')
-rw-r--r--src/constrain.cpp36
1 files changed, 12 insertions, 24 deletions
diff --git a/src/constrain.cpp b/src/constrain.cpp
index 2e23f7c..8d16218 100644
--- a/src/constrain.cpp
+++ b/src/constrain.cpp
@@ -53,20 +53,8 @@ ASymbol::constrain(TEnv& tenv, Constraints& c) const throw(Error)
c.constrain(tenv, this, *ref);
}
-void
-ATuple::constrain(TEnv& tenv, Constraints& c) const throw(Error)
-{
- TList t;
- FOREACHP(const_iterator, p, this) {
- (*p)->constrain(tenv, c);
- t.push_back(const_cast<AType*>(tenv.var(*p)));
- }
- t.head->loc = loc;
- c.constrain(tenv, this, t);
-}
-
static void
-constrain_fn(TEnv& tenv, Constraints& c, const ACall* call) throw(Error)
+constrain_fn(TEnv& tenv, Constraints& c, const ATuple* call) throw(Error)
{
set<const ASymbol*> defs;
TEnv::Frame frame;
@@ -93,7 +81,7 @@ constrain_fn(TEnv& tenv, Constraints& c, const ACall* call) throw(Error)
// Add internal definitions to environment frame
for (++i; i != call->end(); ++i) {
const AST* exp = *i;
- const ACall* call = exp->to<const ACall*>();
+ const ATuple* call = exp->to<const ATuple*>();
if (call && is_form(call, "def")) {
const ASymbol* sym = call->list_ref(1)->as<const ASymbol*>();
THROW_IF(defs.count(sym) != 0, call->loc,
@@ -121,7 +109,7 @@ constrain_fn(TEnv& tenv, Constraints& c, const ACall* call) throw(Error)
}
static void
-constrain_def(TEnv& tenv, Constraints& c, const ACall* call) throw(Error)
+constrain_def(TEnv& tenv, Constraints& c, const ATuple* call) throw(Error)
{
THROW_IF(call->list_len() != 3, call->loc, "`def' requires exactly 2 arguments");
const ASymbol* const sym = call->list_ref(1)->as<const ASymbol*>();
@@ -136,7 +124,7 @@ constrain_def(TEnv& tenv, Constraints& c, const ACall* call) throw(Error)
}
static void
-constrain_def_type(TEnv& tenv, Constraints& c, const ACall* call) throw(Error)
+constrain_def_type(TEnv& tenv, Constraints& c, const ATuple* call) throw(Error)
{
THROW_IF(call->list_len() < 3, call->loc, "`def-type' requires at least 2 arguments");
ATuple::const_iterator i = call->iter_at(1);
@@ -164,7 +152,7 @@ constrain_def_type(TEnv& tenv, Constraints& c, const ACall* call) throw(Error)
}
static void
-constrain_match(TEnv& tenv, Constraints& c, const ACall* call) throw(Error)
+constrain_match(TEnv& tenv, Constraints& c, const ATuple* call) throw(Error)
{
THROW_IF(call->list_len() < 5, call->loc, "`match' requires at least 4 arguments");
const AST* matchee = call->list_ref(1);
@@ -195,7 +183,7 @@ constrain_match(TEnv& tenv, Constraints& c, const ACall* call) throw(Error)
}
static void
-constrain_if(TEnv& tenv, Constraints& c, const ACall* call) throw(Error)
+constrain_if(TEnv& tenv, Constraints& c, const ATuple* call) throw(Error)
{
THROW_IF(call->list_len() < 4, call->loc, "`if' requires at least 3 arguments");
THROW_IF(call->list_len() % 2 != 0, call->loc, "`if' missing final else clause");
@@ -217,7 +205,7 @@ constrain_if(TEnv& tenv, Constraints& c, const ACall* call) throw(Error)
}
static void
-constrain_cons(TEnv& tenv, Constraints& c, const ACall* call) throw(Error)
+constrain_cons(TEnv& tenv, Constraints& c, const ATuple* call) throw(Error)
{
const ASymbol* sym = (*call->begin())->as<const ASymbol*>();
const AType* type = NULL;
@@ -242,7 +230,7 @@ constrain_cons(TEnv& tenv, Constraints& c, const ACall* call) throw(Error)
}
static void
-constrain_dot(TEnv& tenv, Constraints& c, const ACall* call) throw(Error)
+constrain_dot(TEnv& tenv, Constraints& c, const ATuple* call) throw(Error)
{
THROW_IF(call->list_len() != 3, call->loc, "`.' requires exactly 2 arguments");
ATuple::const_iterator i = call->begin();
@@ -263,14 +251,14 @@ constrain_dot(TEnv& tenv, Constraints& c, const ACall* call) throw(Error)
}
static void
-constrain_quote(TEnv& tenv, Constraints& c, const ACall* call) throw(Error)
+constrain_quote(TEnv& tenv, Constraints& c, const ATuple* call) throw(Error)
{
c.constrain(tenv, call, tenv.named("Quote"));
call->list_ref(1)->constrain(tenv, c);
}
static void
-constrain_call(TEnv& tenv, Constraints& c, const ACall* call) throw(Error)
+constrain_call(TEnv& tenv, Constraints& c, const ATuple* call) throw(Error)
{
const AST* const head = call->head();
@@ -299,7 +287,7 @@ constrain_call(TEnv& tenv, Constraints& c, const ACall* call) throw(Error)
}
static void
-constrain_primitive(TEnv& tenv, Constraints& c, const ACall* call) throw(Error)
+constrain_primitive(TEnv& tenv, Constraints& c, const ATuple* call) throw(Error)
{
const string n = call->head()->to<const ASymbol*>()->str();
enum { ARITHMETIC, BINARY, LOGICAL, COMPARISON } type;
@@ -355,7 +343,7 @@ constrain_primitive(TEnv& tenv, Constraints& c, const ACall* call) throw(Error)
}
void
-ACall::constrain(TEnv& tenv, Constraints& c) const throw(Error)
+ATuple::constrain(TEnv& tenv, Constraints& c) const throw(Error)
{
const ASymbol* const sym = head()->to<const ASymbol*>();
if (!sym) {