aboutsummaryrefslogtreecommitdiffstats
path: root/tuplr.hpp
diff options
context:
space:
mode:
authorDavid Robillard <d@drobilla.net>2009-06-18 20:50:57 +0000
committerDavid Robillard <d@drobilla.net>2009-06-18 20:50:57 +0000
commit450137a8283cdc123b22a884d6af7fef2f3aae76 (patch)
tree540ac587755a126c84751218dcef8229a941a154 /tuplr.hpp
parent936f996c4091266e9404f346e2939e613121f74c (diff)
downloadresp-450137a8283cdc123b22a884d6af7fef2f3aae76.tar.gz
resp-450137a8283cdc123b22a884d6af7fef2f3aae76.tar.bz2
resp-450137a8283cdc123b22a884d6af7fef2f3aae76.zip
Rearrange Error order.
git-svn-id: http://svn.drobilla.net/resp/tuplr@122 ad02d1e2-f140-0410-9f75-f8b11f17cedd
Diffstat (limited to 'tuplr.hpp')
-rw-r--r--tuplr.hpp10
1 files changed, 5 insertions, 5 deletions
diff --git a/tuplr.hpp b/tuplr.hpp
index 2f66d9f..025dd55 100644
--- a/tuplr.hpp
+++ b/tuplr.hpp
@@ -50,10 +50,10 @@ struct Cursor {
/// Compiler error
struct Error {
- Error(const string& m, Cursor c) : msg(m), loc(c) {}
+ Error(Cursor c, const string& m) : loc(c), msg(m) {}
const string what() const { return (loc ? loc.str() + ": " : "") + "error: " + msg; }
- string msg;
Cursor loc;
+ string msg;
};
/// Expression ::= Atom | (SubExp*)
@@ -160,7 +160,7 @@ struct AST {
template<typename T> T to() const { return dynamic_cast<T>(this); }
template<typename T> T as() {
T t = dynamic_cast<T>(this);
- if (!t) throw Error("internal error: bad cast", loc);
+ if (!t) throw Error(loc, "internal error: bad cast");
return t;
}
Cursor loc;
@@ -220,7 +220,7 @@ struct ATuple : public AST, public vector<AST*> {
return false;
}
void constrain(TEnv& tenv, Constraints& c) const;
- CValue compile(CEnv& cenv) { throw Error("tuple compiled", loc); }
+ CValue compile(CEnv& cenv) { throw Error(loc, "tuple compiled"); }
};
/// Type Expression, e.g. "Int", "(Fn (Int Int) Float)"
@@ -414,7 +414,7 @@ struct PEnv : private map<const string, ASymbol*> {
}
AST* parse(const SExp& exp) {
if (exp.type == SExp::LIST) {
- if (exp.empty()) throw Error("call to empty list", exp.loc);
+ if (exp.empty()) throw Error(exp.loc, "call to empty list");
if (exp.front().type == SExp::ATOM) {
MF mf = mac(exp.front().atom);
SExp expanded = (mf ? mf(*this, exp) : exp);