diff options
-rw-r--r-- | tuplr.hpp | 24 |
1 files changed, 9 insertions, 15 deletions
@@ -26,11 +26,11 @@ #include <vector> #include <boost/format.hpp> -// Actual types are backend specific -typedef void* CValue; -typedef const void* CType; -typedef void* CFunction; -struct CEngine; +typedef void* CValue; ///< Compiled value (opaque) +typedef const void* CType; ///< Compiled type (opaque) +typedef void* CFunction; ///< Compiled function (opaque) + +struct CEngine; ///< Backend data (opaque) #define FOREACH(IT, i, c) for (IT i = (c).begin(); i != (c).end(); ++i) @@ -141,15 +141,11 @@ struct ASTTuple : public AST, public vector<AST*> { } bool operator==(const AST& rhs) const { const ASTTuple* rt = dynamic_cast<const ASTTuple*>(&rhs); - if (!rt) return false; - if (rt->size() != size()) return false; + if (!rt || rt->size() != size()) return false; const_iterator l = begin(); - FOREACH(const_iterator, r, *rt) { - AST* mine = *l++; - AST* other = *r; - if (!(*mine == *other)) + FOREACH(const_iterator, r, *rt) + if (!(*(*l++) == *(*r))) return false; - } return true; } void lift(CEnv& cenv) { @@ -192,9 +188,7 @@ struct AType : public ASTTuple { } bool operator==(const AST& rhs) const { const AType* rt = dynamic_cast<const AType*>(&rhs); - if (!rt) - return false; - else if (kind != rt->kind) + if (!rt || kind != rt->kind) return false; else switch (kind) { |