diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/resp.hpp | 34 |
1 files changed, 8 insertions, 26 deletions
diff --git a/src/resp.hpp b/src/resp.hpp index 899f4fb..0c698a9 100644 --- a/src/resp.hpp +++ b/src/resp.hpp @@ -22,9 +22,6 @@ #ifndef RESP_HPP #define RESP_HPP -#include <stdarg.h> -#include <stdint.h> -#include <string.h> #include <iostream> #include <list> #include <map> @@ -33,6 +30,11 @@ #include <stack> #include <string> #include <vector> + +#include <stdarg.h> +#include <stdint.h> +#include <string.h> + #include <boost/format.hpp> #define FOREACH(IT, i, c) for (IT i = (c).begin(); i != (c).end(); ++i) @@ -213,20 +215,11 @@ struct AST : public Object { bool operator==(const AST& o) const; string str() const { ostringstream ss; ss << this; return ss.str(); } - ATuple* as_tuple() { - assert(tag() == T_TUPLE || tag() == T_TYPE); - return (ATuple*)this; - } const ATuple* as_tuple() const { assert(tag() == T_TUPLE || tag() == T_TYPE); return (ATuple*)this; } - ATuple* to_tuple() { - if (tag() == T_TUPLE || tag() == T_TYPE) - return (ATuple*)this; - return NULL; - } const ATuple* to_tuple() const { if (tag() == T_TUPLE || tag() == T_TYPE) return (const ATuple*)this; @@ -234,23 +227,12 @@ struct AST : public Object { } template<typename T> - T* as_a(Tag t) { - assert(tag() == t); - return (T*)this; - } - template<typename T> T* as_a(Tag t) const { assert(tag() == t); return (T*)this; } template<typename T> - T* to_a(Tag t) { - if (tag() == t) - return (T*)this; - return NULL; - } - template<typename T> T* to_a(Tag t) const { if (tag() == t) return (T*)this; @@ -747,9 +729,9 @@ struct Engine { virtual CVal compileLiteral(CEnv& cenv, const AST* lit) = 0; virtual CVal compileString(CEnv& cenv, const char* str) = 0; virtual CVal compileCall(CEnv& cenv, CFunc f, const AType* fT, ValVec& args) = 0; - virtual CVal compilePrimitive(CEnv& cenv, const ATuple* prim) = 0; - virtual CVal compileIf(CEnv& cenv, const ATuple* aif) = 0; - virtual CVal compileMatch(CEnv& cenv, const ATuple* match) = 0; + virtual CVal compilePrimitive(CEnv& cenv, const ATuple* prim) = 0; + virtual CVal compileIf(CEnv& cenv, const ATuple* aif) = 0; + virtual CVal compileMatch(CEnv& cenv, const ATuple* match) = 0; virtual CVal compileGlobal(CEnv& cenv, const AType* t, const string& sym, CVal val) = 0; virtual CVal getGlobal(CEnv& cenv, const string& sym, CVal val) = 0; virtual void writeModule(CEnv& cenv, std::ostream& os) = 0; |