aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDavid Robillard <d@drobilla.net>2009-10-06 23:25:32 +0000
committerDavid Robillard <d@drobilla.net>2009-10-06 23:25:32 +0000
commit93ee565c32bc12ae87aa3696a7b284f8958010ce (patch)
tree7ddd9d66516f295659e5cd368178239b1a384b8c
parent33d1fba9ba1a16a37a050d40f85600e03f6b461c (diff)
downloadresp-93ee565c32bc12ae87aa3696a7b284f8958010ce.tar.gz
resp-93ee565c32bc12ae87aa3696a7b284f8958010ce.tar.bz2
resp-93ee565c32bc12ae87aa3696a7b284f8958010ce.zip
Shrink.
git-svn-id: http://svn.drobilla.net/resp/tuplr@201 ad02d1e2-f140-0410-9f75-f8b11f17cedd
-rw-r--r--src/tuplr.hpp6
1 files changed, 2 insertions, 4 deletions
diff --git a/src/tuplr.hpp b/src/tuplr.hpp
index c31e000..0141592 100644
--- a/src/tuplr.hpp
+++ b/src/tuplr.hpp
@@ -199,13 +199,11 @@ struct AST : public Object {
template<typename T> T const to() const { return dynamic_cast<T const>(this); }
template<typename T> T as() {
T t = dynamic_cast<T>(this);
- if (!t) throw Error(loc, "internal error: bad cast");
- return t;
+ return t ? t : throw Error(loc, "internal error: bad cast");
}
template<typename T> T const as() const {
T const t = dynamic_cast<T const>(this);
- if (!t) throw Error(loc, "internal error: bad cast");
- return t;
+ return t ? t : throw Error(loc, "internal error: bad cast");
}
Cursor loc;
};