aboutsummaryrefslogtreecommitdiffstats
path: root/typing.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'typing.cpp')
-rw-r--r--typing.cpp20
1 files changed, 10 insertions, 10 deletions
diff --git a/typing.cpp b/typing.cpp
index 837b1c3..759a418 100644
--- a/typing.cpp
+++ b/typing.cpp
@@ -57,9 +57,9 @@ ASTCall::constrain(TEnv& tenv) const
void
ASTDefinition::constrain(TEnv& tenv) const
{
- if (size() != 3) throw Error("`def' requires exactly 2 arguments", exp.loc);
+ if (size() != 3) throw Error("`def' requires exactly 2 arguments", loc);
if (!dynamic_cast<const ASTSymbol*>(at(1)))
- throw Error("`def' name is not a symbol", exp.loc);
+ throw Error("`def' name is not a symbol", loc);
FOREACH(const_iterator, p, *this)
(*p)->constrain(tenv);
AType* tvar = tenv.type(this);
@@ -70,8 +70,8 @@ ASTDefinition::constrain(TEnv& tenv) const
void
ASTIf::constrain(TEnv& tenv) const
{
- if (size() < 3) throw Error("`if' requires exactly 3 arguments", exp.loc);
- if (size() % 2 != 0) throw Error("`if' missing final else clause", exp.loc);
+ if (size() < 3) throw Error("`if' requires exactly 3 arguments", loc);
+ if (size() % 2 != 0) throw Error("`if' missing final else clause", loc);
FOREACH(const_iterator, p, *this)
(*p)->constrain(tenv);
AType* retT = tenv.type(this);
@@ -99,7 +99,7 @@ ASTPrimitive::constrain(TEnv& tenv) const
else if (n == "=" || n == "!=" || n == ">" || n == ">=" || n == "<" || n == "<=")
type = COMPARISON;
else
- throw Error((format("unknown primitive `%1%'") % n).str(), exp.loc);
+ throw Error((format("unknown primitive `%1%'") % n).str(), loc);
FOREACH(const_iterator, p, *this)
(*p)->constrain(tenv);
@@ -107,31 +107,31 @@ ASTPrimitive::constrain(TEnv& tenv) const
switch (type) {
case ARITHMETIC:
if (size() < 3)
- throw Error((format("`%1%' requires at least 2 arguments") % n).str(), exp.loc);
+ throw Error((format("`%1%' requires at least 2 arguments") % n).str(), loc);
for (size_t i = 1; i < size(); ++i)
tenv.constrain(at(i), tenv.type(this));
break;
case BINARY:
if (size() != 3)
- throw Error((format("`%1%' requires exactly 2 arguments") % n).str(), exp.loc);
+ throw Error((format("`%1%' requires exactly 2 arguments") % n).str(), loc);
tenv.constrain(at(1), tenv.type(this));
tenv.constrain(at(2), tenv.type(this));
break;
case BITWISE:
if (size() != 3)
- throw Error((format("`%1%' requires exactly 2 arguments") % n).str(), exp.loc);
+ throw Error((format("`%1%' requires exactly 2 arguments") % n).str(), loc);
tenv.constrain(this, tenv.named("Bool"));
tenv.constrain(at(1), tenv.named("Bool"));
tenv.constrain(at(2), tenv.named("Bool"));
break;
case COMPARISON:
if (size() != 3)
- throw Error((format("`%1%' requires exactly 2 arguments") % n).str(), exp.loc);
+ throw Error((format("`%1%' requires exactly 2 arguments") % n).str(), loc);
tenv.constrain(this, tenv.named("Bool"));
tenv.constrain(at(1), tenv.type(at(2)));
break;
default:
- throw Error((format("unknown primitive `%1%'") % n).str(), exp.loc);
+ throw Error((format("unknown primitive `%1%'") % n).str(), loc);
}
}