summaryrefslogtreecommitdiff
path: root/node/BaseNode.hh
diff options
context:
space:
mode:
authorNagi5Yeq <wu@x-nagi.com>2020-05-25 00:53:57 +0800
committerNagi5Yeq <wu@x-nagi.com>2020-05-25 00:53:57 +0800
commitc5e9f890dab0e4595482301d77876793c8bceb8c (patch)
treecb115b6b5b8ffaa5d0de88f9ad5df34016223ec6 /node/BaseNode.hh
parent3832be8be4b23fb9e93a3f181e4205eadbdbf4de (diff)
finish function node.
Parser.y: rename 'context' to 'ctx' to avoid conflict in new version bison.
Diffstat (limited to 'node/BaseNode.hh')
-rw-r--r--node/BaseNode.hh12
1 files changed, 12 insertions, 0 deletions
diff --git a/node/BaseNode.hh b/node/BaseNode.hh
index ab0b96a..bec9ebd 100644
--- a/node/BaseNode.hh
+++ b/node/BaseNode.hh
@@ -1,6 +1,8 @@
#ifndef PCC_BASENODE_H
#define PCC_BASENODE_H
+#include <vector>
+
#include "Context.hh"
namespace pcc {
@@ -12,6 +14,16 @@ class BaseNode {
protected:
Context* context_;
};
+
+template <typename T, class Base = BaseNode> class ListNode : public Base {
+ public:
+ ListNode(Context* context)
+ : Base(context) {}
+ virtual Value CodeGen();
+
+ private:
+ std::vector<T> childs_;
+};
} // namespace pcc
#endif