Changeset ce55a81 for src/AST/Pass.impl.hpp
- Timestamp:
- Sep 4, 2020, 2:14:10 PM (5 years ago)
- Branches:
- ADT, arm-eh, ast-experimental, enum, forall-pointer-decay, jacob/cs343-translation, master, new-ast-unique-expr, pthread-emulation, qualifiedEnum
- Children:
- 14d8a9b
- Parents:
- 56c44dc (diff), 2801829 (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/Pass.impl.hpp (modified) (9 diffs)
Legend:
- Unmodified
- Added
- Removed
-
src/AST/Pass.impl.hpp
r56c44dc rce55a81 57 57 58 58 namespace ast { 59 template<typename node_t> 60 node_t * shallowCopy( const node_t * node ); 61 59 62 namespace __pass { 60 63 // Check if this is either a null pointer or a pointer to an empty container … … 62 65 static inline bool empty( T * ptr ) { 63 66 return !ptr || ptr->empty(); 67 } 68 69 template< typename core_t, typename node_t > 70 static inline node_t* mutate(const node_t *node) { 71 return std::is_base_of<PureVisitor, core_t>::value ? ::ast::shallowCopy(node) : ::ast::mutate(node); 64 72 } 65 73 … … 320 328 321 329 if( __pass::differs(old_val, new_val) ) { 322 auto new_parent = mutate(parent);330 auto new_parent = __pass::mutate<core_t>(parent); 323 331 new_parent->*child = new_val; 324 332 parent = new_parent; … … 334 342 if ( node->forall.empty() ) return; 335 343 336 node_t * mut = mutate( node );344 node_t * mut = __pass::mutate<core_t>( node ); 337 345 mut->forall = subs->clone( node->forall, *this ); 338 346 node = mut; … … 894 902 895 903 if(mutated) { 896 auto n = mutate(node);904 auto n = __pass::mutate<core_t>(node); 897 905 n->clauses = std::move( new_clauses ); 898 906 node = n; … … 904 912 auto nval = call_accept( node->field ); \ 905 913 if(nval != node->field ) { \ 906 auto nparent = mutate(node); \914 auto nparent = __pass::mutate<core_t>(node); \ 907 915 nparent->field = nval; \ 908 916 node = nparent; \ … … 1610 1618 1611 1619 if(mutated) { 1612 auto n = mutate(node);1620 auto n = __pass::mutate<core_t>(node); 1613 1621 n->associations = std::move( new_kids ); 1614 1622 node = n; … … 1940 1948 } 1941 1949 if (mutated) { 1942 auto new_node = mutate( node );1950 auto new_node = __pass::mutate<core_t>( node ); 1943 1951 new_node->typeEnv.swap( new_map ); 1944 1952 node = new_node; … … 1956 1964 } 1957 1965 if (mutated) { 1958 auto new_node = mutate( node );1966 auto new_node = __pass::mutate<core_t>( node ); 1959 1967 new_node->varEnv.swap( new_map ); 1960 1968 node = new_node;
Note:
See TracChangeset
for help on using the changeset viewer.