| 227 | uint32_t hash_; //for node dedup |
| 228 | |
| 229 | void RecursiveCopyFrom(const AstNode &other) { |
| 230 | // copy children |
| 231 | if (other.child0_) { |
| 232 | if (this->child0_ == 0) { |
| 233 | child0_ = root_->size(); |
| 234 | root_->emplace_back(AstNode(root_)); |
| 235 | } |
| 236 | root_->at(child0_).RecursiveCopyFrom(other.children(0)); |
| 237 | } else { |
| 238 | child0_ = 0; |
| 239 | } |
| 240 | if (other.child1_) { |
| 241 | if (this->child1_ == 0) { |
| 242 | child1_ = root_->size(); |
| 243 | root_->emplace_back(AstNode(root_)); |
| 244 | } |
| 245 | root_->at(child1_).RecursiveCopyFrom(other.children(1)); |
| 246 | } else { |
| 247 | child1_ = 0; |
| 248 | } |
| 249 | // copy other fields |
| 250 | kind_ = other.kind_; |
| 251 | bits_ = other.bits_; |
| 252 | index_ = other.index_; |
| 253 | boolvalue_ = other.boolvalue_; |
| 254 | label_ = other.label_; |
| 255 | hash_ = other.hash_; |
| 256 | } |
| 257 | }; |
| 258 | |
| 259 | static bool isEqualAstRecursive(const AstNode& lhs, const AstNode& rhs) { |