Changes in src/AST/Node.hpp [7d0881c:18e683b]
- File:
-
- 1 edited
-
src/AST/Node.hpp (modified) (6 diffs)
Legend:
- Unmodified
- Added
- Removed
-
src/AST/Node.hpp
r7d0881c r18e683b 38 38 Node& operator= (const Node&) = delete; 39 39 Node& operator= (Node&&) = delete; 40 virtual ~Node() {}40 virtual ~Node() = default; 41 41 42 42 virtual const Node * accept( Visitor & v ) const = 0; … … 69 69 } 70 70 71 void decrement(ast::Node::ref_type ref , bool do_delete = true) const {71 void decrement(ast::Node::ref_type ref) const { 72 72 switch (ref) { 73 73 case ref_type::strong: strong_count--; break; … … 75 75 } 76 76 77 if( do_delete &&!strong_count && !weak_count) {77 if(!strong_count && !weak_count) { 78 78 delete this; 79 79 } … … 123 123 (ret->*field)[i] = std::forward< field_t >( val ); 124 124 return ret; 125 }126 127 /// Mutate an entire indexed collection by cloning to accepted value128 template<typename node_t, typename parent_t, typename coll_t>129 const node_t * mutate_each( const node_t * node, coll_t parent_t::* field, Visitor & v ) {130 for ( unsigned i = 0; i < (node->*field).size(); ++i ) {131 node = mutate_field_index( node, field, i, (node->*field)[i]->accept( v ) );132 }133 return node;134 125 } 135 126 … … 228 219 operator const node_t * () const { _check(); return node; } 229 220 230 const node_t * release() {231 const node_t * ret = node;232 if ( node ) {233 _dec(node, false);234 node = nullptr;235 }236 return ret;237 }238 239 221 /// wrapper for convenient access to dynamic_cast 240 222 template<typename o_node_t> … … 262 244 263 245 void _inc( const node_t * other ); 264 void _dec( const node_t * other , bool do_delete = true);246 void _dec( const node_t * other ); 265 247 void _check() const; 266 248
Note:
See TracChangeset
for help on using the changeset viewer.