Changes in src/AST/Node.cpp [76ed81f:10a1225]
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
src/AST/Node.cpp
r76ed81f r10a1225 16 16 #include "Node.hpp" 17 17 #include "Fwd.hpp" 18 19 #include <iostream>20 18 21 19 #include "Attribute.hpp" … … 27 25 #include "TypeSubstitution.hpp" 28 26 29 #include "Print.hpp"30 31 27 template< typename node_t, enum ast::Node::ref_type ref_t > 32 28 void ast::ptr_base<node_t, ref_t>::_inc( const node_t * node ) { node->increment(ref_t); } … … 35 31 void ast::ptr_base<node_t, ref_t>::_dec( const node_t * node ) { node->decrement(ref_t); } 36 32 33 /// Sets this pointer to a mutated version of a pointer (possibly) owned elsehere. 34 /// Returns a mutable version of the pointer in this node. 37 35 template< typename node_t, enum ast::Node::ref_type ref_t > 38 node_t * ast::ptr_base<node_t, ref_t>::get_and_mutate() { 36 node_t * ast::ptr_base<node_t, ref_t>::set_and_mutate( const node_t * n ) { 37 // ensure ownership of `n` by this node to avoid spurious single-owner mutates 38 assign( n ); 39 39 // get mutable version of `n` 40 40 auto r = mutate( node ); … … 42 42 assign( r ); 43 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 mutates49 assign( n );50 // return mutable version51 return get_and_mutate();52 }53 54 std::ostream & ast::operator<< ( std::ostream & out, const ast::Node * node ) {55 print(out, node);56 return out;57 44 } 58 45
Note:
See TracChangeset
for help on using the changeset viewer.