aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDavid Robillard <d@drobilla.net>2009-03-13 03:21:53 +0000
committerDavid Robillard <d@drobilla.net>2009-03-13 03:21:53 +0000
commit6bed972454d60c503b760bcac92c4e36ba95520d (patch)
tree245fae0c6759f3a84bc9e14531e31284eb2de84b
parent534a30b988ffc35687feb05765c10131a3f85ead (diff)
downloadresp-6bed972454d60c503b760bcac92c4e36ba95520d.tar.gz
resp-6bed972454d60c503b760bcac92c4e36ba95520d.tar.bz2
resp-6bed972454d60c503b760bcac92c4e36ba95520d.zip
Don't use TEnv.var() where unnecessary (this needs to go away? maybe?)
git-svn-id: http://svn.drobilla.net/resp/tuplr@87 ad02d1e2-f140-0410-9f75-f8b11f17cedd
-rw-r--r--tuplr.hpp8
-rw-r--r--typing.cpp6
2 files changed, 7 insertions, 7 deletions
diff --git a/tuplr.hpp b/tuplr.hpp
index 68e55f3..a16072d 100644
--- a/tuplr.hpp
+++ b/tuplr.hpp
@@ -251,10 +251,10 @@ struct Funcs : public list< pair<AType*, CFunction> > {
struct AClosure : public ATuple {
AClosure(Cursor c, ASymbol* fn, ATuple* p, AST* b, const string& n="")
: ATuple(c, fn, p, b, NULL), name(n) {}
- bool operator==(const AST& rhs) const { return this == &rhs; }
- void constrain(TEnv& tenv) const;
- void lift(CEnv& cenv);
- CValue compile(CEnv& cenv);
+ bool operator==(const AST& rhs) const { return this == &rhs; }
+ void constrain(TEnv& tenv) const;
+ void lift(CEnv& cenv);
+ CValue compile(CEnv& cenv);
ATuple* prot() const { return dynamic_cast<ATuple*>(at(1)); }
private:
Funcs funcs;
diff --git a/typing.cpp b/typing.cpp
index 4e3fce5..fdea255 100644
--- a/typing.cpp
+++ b/typing.cpp
@@ -152,7 +152,7 @@ ACarCall::constrain(TEnv& tenv) const
{
if (size() != 2) throw Error("`car' requires exactly 1 argument", loc);
at(1)->constrain(tenv);
- AType* carT = tenv.var(loc);
+ AType* carT = tenv.type(this);
AType* pairT = new AType(at(1)->loc, tenv.penv.sym("Pair"), carT, tenv.var(), 0);
tenv.constrain(at(1), pairT);
tenv.constrain(this, carT);
@@ -163,7 +163,7 @@ ACdrCall::constrain(TEnv& tenv) const
{
if (size() != 2) throw Error("`cdr' requires exactly 1 argument", loc);
at(1)->constrain(tenv);
- AType* cdrT = tenv.var(loc);
+ AType* cdrT = tenv.type(this);
AType* pairT = new AType(at(1)->loc, tenv.penv.sym("Pair"), tenv.var(), cdrT, 0);
tenv.constrain(at(1), pairT);
tenv.constrain(this, cdrT);
@@ -240,7 +240,7 @@ TEnv::unify(const Constraints& constraints) // TAPL 22.4
return unify(cp);
} else {
throw Error((format("type is `%1%' but should be `%2%'") % s->str() % t->str()).str(),
- constraints.begin()->loc);
+ s->loc ? s->loc : t->loc);
}
}