| 144 | class AstNode { |
| 145 | public: |
| 146 | AstNode(size_t size=32) : child0_(0), child1_(0), kind_(0), bits_(0), index_(0), |
| 147 | boolvalue_(0), is_root_(1), label_(0), hash_(0) { |
| 148 | root_ = new std::vector<AstNode>(); // only allocate if is root |
| 149 | root_->reserve(size + 1); // default capacity, +1 for dummy root |
| 150 | root_->emplace_back(AstNode(root_)); // add a dummy root |
| 151 | } |
| 152 | AstNode(std::vector<AstNode> *r) : root_(r), child0_(0), child1_(0), |
| 153 | kind_(0), bits_(0), index_(0), boolvalue_(0), is_root_(0), label_(0), |
| 154 | hash_(0) {} // don't allocate if not root |