Changeset 76ed81f for src/AST/Node.cpp


Ignore:
Timestamp:
May 22, 2019, 5:22:30 PM (5 years ago)
Author:
Aaron Moss <a3moss@…>
Branches:
ADT, arm-eh, ast-experimental, cleanup-dtors, enum, forall-pointer-decay, jacob/cs343-translation, jenkins-sandbox, master, new-ast, new-ast-unique-expr, pthread-emulation, qualifiedEnum
Children:
893e106
Parents:
6380f78
Message:

Broken stuff pre-Pass fix

File:
1 edited

Legend:

Unmodified
Added
Removed
  • src/AST/Node.cpp

    r6380f78 r76ed81f  
    3535void ast::ptr_base<node_t, ref_t>::_dec( const node_t * node ) { node->decrement(ref_t); }
    3636
    37 /// Sets this pointer to a mutated version of a pointer (possibly) owned elsehere.
    38 /// Returns a mutable version of the pointer in this node.
    39 template< typename node_t, enum ast::Node::ref_type ref_t >
    40 node_t * ast::ptr_base<node_t, ref_t>::set_and_mutate( const node_t * n ) {
    41         // ensure ownership of `n` by this node to avoid spurious single-owner mutates
    42         assign( n );
     37template< typename node_t, enum ast::Node::ref_type ref_t >
     38node_t * ast::ptr_base<node_t, ref_t>::get_and_mutate() {
    4339        // get mutable version of `n`
    4440        auto r = mutate( node );
     
    4642        assign( r );
    4743        return r;
     44}
     45
     46template< typename node_t, enum ast::Node::ref_type ref_t >
     47node_t * ast::ptr_base<node_t, ref_t>::set_and_mutate( const node_t * n ) {
     48        // ensure ownership of `n` by this node to avoid spurious single-owner mutates
     49        assign( n );
     50        // return mutable version
     51        return get_and_mutate();
    4852}
    4953
Note: See TracChangeset for help on using the changeset viewer.