Ignore:
File:
1 edited

Legend:

Unmodified
Added
Removed
  • src/AST/Node.hpp

    r7d0881c r18e683b  
    3838        Node& operator= (const Node&) = delete;
    3939        Node& operator= (Node&&) = delete;
    40         virtual ~Node() {}
     40        virtual ~Node() = default;
    4141
    4242        virtual const Node * accept( Visitor & v ) const = 0;
     
    6969        }
    7070
    71         void decrement(ast::Node::ref_type ref, bool do_delete = true) const {
     71        void decrement(ast::Node::ref_type ref) const {
    7272                switch (ref) {
    7373                        case ref_type::strong: strong_count--; break;
     
    7575                }
    7676
    77                 if( do_delete && !strong_count && !weak_count) {
     77                if(!strong_count && !weak_count) {
    7878                        delete this;
    7979                }
     
    123123        (ret->*field)[i] = std::forward< field_t >( val );
    124124        return ret;
    125 }
    126 
    127 /// Mutate an entire indexed collection by cloning to accepted value
    128 template<typename node_t, typename parent_t, typename coll_t>
    129 const node_t * mutate_each( const node_t * node, coll_t parent_t::* field, Visitor & v ) {
    130         for ( unsigned i = 0; i < (node->*field).size(); ++i ) {
    131                 node = mutate_field_index( node, field, i, (node->*field)[i]->accept( v ) );
    132         }
    133         return node;
    134125}
    135126
     
    228219        operator const node_t * () const { _check(); return node; }
    229220
    230         const node_t * release() {
    231                 const node_t * ret = node;
    232                 if ( node ) {
    233                         _dec(node, false);
    234                         node = nullptr;
    235                 }
    236                 return ret;
    237         }
    238 
    239221        /// wrapper for convenient access to dynamic_cast
    240222        template<typename o_node_t>
     
    262244
    263245        void _inc( const node_t * other );
    264         void _dec( const node_t * other, bool do_delete = true );
     246        void _dec( const node_t * other );
    265247        void _check() const;
    266248
Note: See TracChangeset for help on using the changeset viewer.