Changes in src/AST/Node.cpp [461046f:76ed81f]
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
src/AST/Node.cpp
r461046f r76ed81f 35 35 void ast::ptr_base<node_t, ref_t>::_dec( const node_t * node ) { node->decrement(ref_t); } 36 36 37 /// Sets this pointer to a mutated version of a pointer (possibly) owned elsehere. 38 /// Returns a mutable version of the pointer in this node. 39 template< typename node_t, enum ast::Node::ref_type ref_t > 40 node_t * ast::ptr_base<node_t, ref_t>::set_and_mutate( const node_t * n ) { 41 // ensure ownership of `n` by this node to avoid spurious single-owner mutates 42 assign( n ); 37 template< typename node_t, enum ast::Node::ref_type ref_t > 38 node_t * ast::ptr_base<node_t, ref_t>::get_and_mutate() { 43 39 // get mutable version of `n` 44 40 auto r = mutate( node ); … … 46 42 assign( r ); 47 43 return r; 44 } 45 46 template< typename node_t, enum ast::Node::ref_type ref_t > 47 node_t * ast::ptr_base<node_t, ref_t>::set_and_mutate( const node_t * n ) { 48 // ensure ownership of `n` by this node to avoid spurious single-owner mutates 49 assign( n ); 50 // return mutable version 51 return get_and_mutate(); 48 52 } 49 53
Note: See TracChangeset
for help on using the changeset viewer.