diff options
Diffstat (limited to 'src/constrain.cpp')
-rw-r--r-- | src/constrain.cpp | 12 |
1 files changed, 6 insertions, 6 deletions
diff --git a/src/constrain.cpp b/src/constrain.cpp index b4afe09..2fd3fa9 100644 --- a/src/constrain.cpp +++ b/src/constrain.cpp @@ -112,13 +112,13 @@ ACall::constrain(TEnv& tenv, Constraints& c) const for (size_t i = 0; i < size(); ++i) at(i)->constrain(tenv, c); - const AType* fnType = tenv.var(at(0)); + const AType* fnType = tenv.var(head()); if (fnType->kind != AType::VAR) { if (fnType->kind == AType::PRIM || fnType->size() < 2 - || !fnType->at(0)->to<const ASymbol*>() - || fnType->at(0)->to<const ASymbol*>()->cppstr != "Fn") - throw Error(loc, (format("call to non-function `%1%'") % at(0)->str()).str()); + || !fnType->head()->to<const ASymbol*>() + || fnType->head()->to<const ASymbol*>()->cppstr != "Fn") + throw Error(loc, (format("call to non-function `%1%'") % head()->str()).str()); size_t numArgs = fnType->at(1)->to<const ATuple*>()->size(); THROW_IF(numArgs != size() - 1, loc, @@ -130,7 +130,7 @@ ACall::constrain(TEnv& tenv, Constraints& c) const for (size_t i = 1; i < size(); ++i) argsT->push_back(tenv.var(at(i))); - c.constrain(tenv, at(0), tup<AType>(at(0)->loc, tenv.penv.sym("Fn"), argsT, retT, 0)); + c.constrain(tenv, head(), tup<AType>(head()->loc, tenv.penv.sym("Fn"), argsT, retT, 0)); c.constrain(tenv, this, retT); } @@ -169,7 +169,7 @@ AIf::constrain(TEnv& tenv, Constraints& c) const void APrimitive::constrain(TEnv& tenv, Constraints& c) const { - const string n = at(0)->to<const ASymbol*>()->str(); + const string n = head()->to<const ASymbol*>()->str(); enum { ARITHMETIC, BINARY, LOGICAL, COMPARISON } type; if (n == "+" || n == "-" || n == "*" || n == "/") type = ARITHMETIC; |