Changeset 92538ab for src/AST/Node.hpp
- Timestamp:
- Apr 10, 2022, 2:53:18 PM (4 years ago)
- Branches:
- ADT, ast-experimental, enum, master, pthread-emulation, qualifiedEnum
- Children:
- d8e2a09
- Parents:
- 4559b34 (diff), 6256891 (diff)
Note: this is a merge changeset, the changes displayed below correspond to the merge itself.
Use the(diff)links above to see all the changes relative to each parent. - File:
-
- 1 edited
-
src/AST/Node.hpp (modified) (6 diffs)
Legend:
- Unmodified
- Added
- Removed
-
src/AST/Node.hpp
r4559b34 r92538ab 10 10 // Created On : Wed May 8 10:27:04 2019 11 11 // Last Modified By : Andrew Beach 12 // Last Modified On : Fri Jun 5 9:47:00 202013 // Update Count : 612 // Last Modified On : Fri Mar 25 10:33:00 2022 13 // Update Count : 7 14 14 // 15 15 … … 103 103 104 104 /// Mutate a node field (only clones if not equal to existing value) 105 template<typename node_t, typename parent_t, typename field_t, typename assn_t>106 const node_t * mutate_field( const node_t * node, field_t parent_t::* field, assn_t && val ) {105 template<typename node_t, typename super_t, typename field_t, typename assn_t> 106 const node_t * mutate_field( const node_t * node, field_t super_t::* field, assn_t && val ) { 107 107 // skip mutate if equivalent 108 108 if ( node->*field == val ) return node; … … 115 115 116 116 /// Mutate a single index of a node field (only clones if not equal to existing value) 117 template<typename node_t, typename parent_t, typename coll_t, typename ind_t, typename field_t>117 template<typename node_t, typename super_t, typename coll_t, typename ind_t, typename field_t> 118 118 const node_t * mutate_field_index( 119 const node_t * node, coll_t parent_t::* field, ind_t i, field_t && val119 const node_t * node, coll_t super_t::* field, ind_t i, field_t && val 120 120 ) { 121 121 // skip mutate if equivalent … … 129 129 130 130 /// Mutate an entire indexed collection by cloning to accepted value 131 template<typename node_t, typename parent_t, typename coll_t>132 const node_t * mutate_each( const node_t * node, coll_t parent_t::* field, Visitor & v ) {131 template<typename node_t, typename super_t, typename coll_t> 132 const node_t * mutate_each( const node_t * node, coll_t super_t::* field, Visitor & v ) { 133 133 for ( unsigned i = 0; i < (node->*field).size(); ++i ) { 134 134 node = mutate_field_index( node, field, i, (node->*field)[i]->accept( v ) ); … … 230 230 } 231 231 232 /// Swaps the nodes contained within two pointers. 233 void swap( ptr_base & other ) noexcept; 234 232 235 const node_t * get() const { _check(); return node; } 233 236 const node_t * operator->() const { _check(); return node; } … … 292 295 template< typename node_t > 293 296 using readonly = ptr_base< node_t, Node::ref_type::weak >; 297 298 /// Non-member swap that an participate in overload resolution. 299 template< typename node_t, enum Node::ref_type ref_t > 300 void swap( ptr_base< node_t, ref_t > & l, ptr_base< node_t, ref_t > & r ) { 301 l.swap( r ); 302 } 303 294 304 } 295 305
Note:
See TracChangeset
for help on using the changeset viewer.