Changes in src/AST/Node.hpp [4864a73:1346914]
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
src/AST/Node.hpp
r4864a73 r1346914 46 46 }; 47 47 48 bool unique() const { return strong_count == 1; }49 50 48 private: 51 49 /// Make a copy of this node; should be overridden in subclass with more precise return type … … 58 56 mutable size_t strong_count = 0; 59 57 mutable size_t weak_count = 0; 60 mutable bool was_ever_strong = false;61 58 62 59 void increment(ref_type ref) const { 63 60 switch (ref) { 64 case ref_type::strong: strong_count++; was_ever_strong = true;break;61 case ref_type::strong: strong_count++; break; 65 62 case ref_type::weak : weak_count ++; break; 66 63 } … … 179 176 } 180 177 181 const node_t * get() const { _check();return node; }182 const node_t * operator->() const { _check();return node; }183 const node_t & operator* () const { _check();return *node; }184 explicit operator bool() const { _check();return node; }185 operator const node_t * () const { _check();return node; }178 const node_t * get() const { return node; } 179 const node_t * operator->() const { return node; } 180 const node_t & operator* () const { return *node; } 181 explicit operator bool() const { return node; } 182 operator const node_t * () const { return node; } 186 183 187 184 /// wrapper for convenient access to dynamic_cast 188 185 template<typename o_node_t> 189 const o_node_t * as() const { _check();return dynamic_cast<const o_node_t *>(node); }186 const o_node_t * as() const { return dynamic_cast<const o_node_t *>(node); } 190 187 191 188 /// wrapper for convenient access to strict_dynamic_cast … … 211 208 void _inc( const node_t * other ); 212 209 void _dec( const node_t * other ); 213 void _check() const;214 210 215 211 protected:
Note: See TracChangeset
for help on using the changeset viewer.