aboutsummaryrefslogtreecommitdiffstats
path: root/src/resp.hpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/resp.hpp')
-rw-r--r--src/resp.hpp24
1 files changed, 12 insertions, 12 deletions
diff --git a/src/resp.hpp b/src/resp.hpp
index 7767d33..d90ccf0 100644
--- a/src/resp.hpp
+++ b/src/resp.hpp
@@ -237,7 +237,7 @@ struct ATuple : public AST {
}
ATuple(Cursor c, AST* ast, va_list args) : AST(T_TUPLE, c), _len(0), _vec(0) {
if (!ast) return;
-
+
_len = 2;
_vec = (const AST**)malloc(sizeof(AST*) * _len);
_vec[0] = ast;
@@ -250,7 +250,7 @@ struct ATuple : public AST {
tail = tup;
}
}
-
+
const AST* head() const { assert(_len > 0); return _vec[0]; }
const AST* last() const { return _vec[_len - 1]; }
bool empty() const { return _len == 0; }
@@ -277,7 +277,7 @@ struct ATuple : public AST {
}
void last(AST* ast) { _vec[_len - 1] = ast; }
-
+
struct const_iterator {
explicit const_iterator(const ATuple* n) : node(n) {
assert(!n || n->tup_len() == 0 || n->tup_len() == 2);
@@ -310,7 +310,7 @@ struct ATuple : public AST {
const AST* operator*() { return node->head(); }
const ATuple* node;
};
-
+
const_iterator begin() const { assert(_len == 0 || _len == 2); return const_iterator(this); }
const_iterator end() const { return const_iterator(NULL); }
@@ -323,9 +323,9 @@ struct ATuple : public AST {
}
const AST* list_ref(unsigned index) const { return *iter_at(index); }
-
+
const ATuple* prot() const { return list_ref(1)->as_tuple(); }
-
+
private:
friend class GC;
size_t _len;
@@ -336,11 +336,11 @@ static bool
list_contains(const ATuple* head, const AST* child) {
if (*head == *child)
return true;
-
+
FOREACHP(ATuple::const_iterator, p, head) {
if (**p == *child)
return true;
-
+
const ATuple* tup = (*p)->to_tuple();
if (tup && list_contains(tup, child))
return true;
@@ -443,7 +443,7 @@ AST::operator==(const AST& rhs) const
const Tag tag = this->tag();
if (tag != rhs.tag())
return false;
-
+
switch (tag) {
case T_BOOL:
return literal_equals((const ALiteral<bool>*)this, (const ALiteral<bool>*)&rhs);
@@ -710,15 +710,15 @@ struct Engine {
const std::string& name,
const ATuple* args,
const AType* type) = 0;
-
+
virtual void pushFnArgs(CEnv& cenv,
const ATuple* prot,
const AType* type,
CFunc f) = 0;
-
+
virtual void finishFn(CEnv& cenv, CFunc f, CVal ret) = 0;
virtual void eraseFn(CEnv& cenv, CFunc f) = 0;
-
+
virtual CVal compileCall(CEnv& cenv, CFunc f, const AType* fT, CVals& args) = 0;
virtual CVal compileCons(CEnv& cenv, const AType* t, CVal rtti, CVals& f) = 0;
virtual CVal compileDot(CEnv& cenv, CVal tup, int32_t index) = 0;