Changes in src/AST/Node.hpp [b7d92b96:4864a73]
- File:
-
- 1 edited
-
src/AST/Node.hpp (modified) (3 diffs)
Legend:
- Unmodified
- Added
- Removed
-
src/AST/Node.hpp
rb7d92b96 r4864a73 18 18 #include <cassert> 19 19 #include <iosfwd> 20 #include <type_traits> // for remove_reference21 20 22 21 #include "Common/ErrorObjects.h" // for SemanticErrorException … … 83 82 }; 84 83 85 // /Mutate a node, non-member function to avoid static type86 // /problems and be able to use auto return84 // Mutate a node, non-member function to avoid static type 85 // problems and be able to use auto return 87 86 template<typename node_t> 88 87 node_t * mutate( const node_t * node ) { … … 96 95 ); 97 96 return node->clone(); 98 }99 100 /// Mutate a node field (only clones if not equal to existing value)101 template<typename node_t, typename field_t>102 const node_t * mutate_field(103 const node_t * node,104 typename std::remove_const<typename std::remove_reference<field_t>::type>::type node_t::* field,105 field_t&& val106 ) {107 if ( node->*field == val ) return node;108 109 node_t * ret = mutate( node );110 ret->*field = std::forward< field_t >( val );111 return ret;112 97 } 113 98
Note:
See TracChangeset
for help on using the changeset viewer.