Changes in src/AST/Node.hpp [76ed81f:8abee136]
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
src/AST/Node.hpp
r76ed81f r8abee136 94 94 std::ostream& operator<< ( std::ostream& out, const Node * node ); 95 95 96 /// Call a visitor on a possibly-null node97 template<typename node_t>98 auto maybe_accept( const node_t * n, Visitor & v ) -> decltype( n->accept(v) ) {99 return n ? n->accept( v ) : nullptr;100 }101 102 96 /// Base class for the smart pointer types 103 97 /// should never really be used. … … 121 115 template<typename o_node_t> 122 116 ptr_base & operator=( const o_node_t * node ) { 123 assign( strict_dynamic_cast<const node_t *>(node));117 assign( node ? strict_dynamic_cast<const node_t *>(node) : nullptr ); 124 118 return *this; 125 119 } … … 146 140 template<typename o_node_t> 147 141 const o_node_t * as() const { return dynamic_cast<const o_node_t *>(node); } 148 149 /// Returns a mutable version of the pointer in this node.150 node_t * get_and_mutate();151 142 152 143 /// Sets this pointer to a mutated version of a pointer (possibly) owned elsehere.
Note: See TracChangeset
for help on using the changeset viewer.