Ignore:
File:
1 edited

Legend:

Unmodified
Added
Removed
  • src/Parser/StatementNode.cc

    rf135b50 r702e826  
    3838        DeclarationNode * agg = decl->extractAggregate();
    3939        if ( agg ) {
    40                 StatementNode * nextStmt = new StatementNode( new DeclStmt( maybeBuild< Declaration >( decl ) ) );
     40                StatementNode * nextStmt = new StatementNode( new DeclStmt( maybeBuild( decl ) ) );
    4141                set_next( nextStmt );
    4242                if ( decl->get_next() ) {
     
    5151                agg = decl;
    5252        } // if
    53         stmt.reset( new DeclStmt( maybeMoveBuild< Declaration >(agg) ) );
     53        stmt.reset( new DeclStmt( maybeMoveBuild( agg ) ) );
    5454} // StatementNode::StatementNode
    5555
     
    7373
    7474Statement * build_expr( ExpressionNode * ctl ) {
    75         Expression * e = maybeMoveBuild< Expression >( ctl );
     75        Expression * e = maybeMoveBuild( ctl );
    7676
    7777        if ( e ) return new ExprStmt( e );
     
    8787        if ( ctl->condition ) {
    8888                // compare the provided condition against 0
    89                 cond = notZeroExpr( maybeMoveBuild< Expression >(ctl->condition) );
     89                cond = notZeroExpr( maybeMoveBuild( ctl->condition ) );
    9090        } else {
    9191                for ( Statement * stmt : init ) {
     
    134134        } // if
    135135        // aststmt.size() == 0 for switch (...) {}, i.e., no declaration or statements
    136         return new SwitchStmt( maybeMoveBuild< Expression >(ctl), aststmt );
     136        return new SwitchStmt( maybeMoveBuild( ctl ), aststmt );
    137137} // build_switch
    138138
    139139Statement * build_case( ExpressionNode * ctl ) {
    140         return new CaseStmt( maybeMoveBuild< Expression >(ctl), {} ); // stmt starts empty and then added to
     140        return new CaseStmt( maybeMoveBuild( ctl ), {} ); // stmt starts empty and then added to
    141141} // build_case
    142142
     
    168168
    169169        // do-while cannot have declarations in the contitional, so init is always empty
    170         return new WhileDoStmt( notZeroExpr( maybeMoveBuild< Expression >(ctl) ), aststmt.front(), astelse.front(), {}, true );
     170        return new WhileDoStmt( notZeroExpr( maybeMoveBuild( ctl ) ), aststmt.front(), astelse.front(), {}, true );
    171171} // build_do_while
    172172
     
    176176
    177177        Expression * astcond = nullptr;                                         // maybe empty
    178         astcond = notZeroExpr( maybeMoveBuild< Expression >(forctl->condition) );
     178        astcond = notZeroExpr( maybeMoveBuild( forctl->condition ) );
    179179
    180180        Expression * astincr = nullptr;                                         // maybe empty
    181         astincr = maybeMoveBuild< Expression >(forctl->change);
     181        astincr = maybeMoveBuild( forctl->change );
    182182        delete forctl;
    183183
     
    199199Statement * build_branch( string * identifier, BranchStmt::Type kind ) {
    200200        Statement * ret = new BranchStmt( * identifier, kind );
    201         delete identifier;                                                                      // allocated by lexer
     201        delete identifier;                                                                      // allocated by lexer
    202202        return ret;
    203203} // build_branch
    204204
    205205Statement * build_computedgoto( ExpressionNode * ctl ) {
    206         return new BranchStmt( maybeMoveBuild< Expression >(ctl), BranchStmt::Goto );
     206        return new BranchStmt( maybeMoveBuild( ctl ), BranchStmt::Goto );
    207207} // build_computedgoto
    208208
     
    236236        list< CatchStmt * > aststmt;
    237237        buildMoveList< CatchStmt, StatementNode >( catch_, aststmt );
    238         CompoundStmt * tryBlock = strict_dynamic_cast< CompoundStmt * >(maybeMoveBuild< Statement >(try_));
    239         FinallyStmt * finallyBlock = dynamic_cast< FinallyStmt * >(maybeMoveBuild< Statement >(finally_) );
     238        CompoundStmt * tryBlock = strict_dynamic_cast< CompoundStmt * >( maybeMoveBuild( try_ ) );
     239        FinallyStmt * finallyBlock = dynamic_cast< FinallyStmt * >( maybeMoveBuild( finally_ ) );
    240240        return new TryStmt( tryBlock, aststmt, finallyBlock );
    241241} // build_try
     
    245245        buildMoveList< Statement, StatementNode >( body, aststmt );
    246246        assert( aststmt.size() == 1 );
    247         return new CatchStmt( kind, maybeMoveBuild< Declaration >(decl), maybeMoveBuild< Expression >(cond), aststmt.front() );
     247        return new CatchStmt( kind, maybeMoveBuild( decl ), maybeMoveBuild( cond ), aststmt.front() );
    248248} // build_catch
    249249
     
    274274
    275275        WaitForStmt::Target target;
    276         target.function = maybeBuild<Expression>( targetExpr );
     276        target.function = maybeBuild( targetExpr );
    277277
    278278        ExpressionNode * next = dynamic_cast<ExpressionNode *>( targetExpr->get_next() );
     
    284284        node->clauses.push_back( WaitForStmt::Clause{
    285285                target,
    286                 maybeMoveBuild<Statement >( stmt ),
    287                 notZeroExpr( maybeMoveBuild<Expression>( when ) )
     286                maybeMoveBuild( stmt ),
     287                notZeroExpr( maybeMoveBuild( when ) )
    288288        });
    289289
     
    293293WaitForStmt * build_waitfor( ExpressionNode * targetExpr, StatementNode * stmt, ExpressionNode * when, WaitForStmt * node ) {
    294294        WaitForStmt::Target target;
    295         target.function = maybeBuild<Expression>( targetExpr );
     295        target.function = maybeBuild( targetExpr );
    296296
    297297        ExpressionNode * next = dynamic_cast<ExpressionNode *>( targetExpr->get_next() );
     
    303303        node->clauses.insert( node->clauses.begin(), WaitForStmt::Clause{
    304304                std::move( target ),
    305                 maybeMoveBuild<Statement >( stmt ),
    306                 notZeroExpr( maybeMoveBuild<Expression>( when ) )
     305                maybeMoveBuild( stmt ),
     306                notZeroExpr( maybeMoveBuild( when ) )
    307307        });
    308308
     
    314314
    315315        if( timeout ) {
    316                 node->timeout.time      = maybeMoveBuild<Expression>( timeout );
    317                 node->timeout.statement = maybeMoveBuild<Statement >( stmt    );
    318                 node->timeout.condition = notZeroExpr( maybeMoveBuild<Expression>( when ) );
     316                node->timeout.time      = maybeMoveBuild( timeout );
     317                node->timeout.statement = maybeMoveBuild( stmt    );
     318                node->timeout.condition = notZeroExpr( maybeMoveBuild( when ) );
    319319        } else {
    320                 node->orelse.statement  = maybeMoveBuild<Statement >( stmt );
    321                 node->orelse.condition  = notZeroExpr( maybeMoveBuild<Expression>( when ) );
     320                node->orelse.statement  = maybeMoveBuild( stmt );
     321                node->orelse.condition  = notZeroExpr( maybeMoveBuild( when ) );
    322322        } // if
    323323
     
    328328        auto node = new WaitForStmt();
    329329
    330         node->timeout.time      = maybeMoveBuild<Expression>( timeout );
    331         node->timeout.statement = maybeMoveBuild<Statement >( stmt    );
    332         node->timeout.condition = notZeroExpr( maybeMoveBuild<Expression>( when ) );
    333 
    334         node->orelse.statement  = maybeMoveBuild<Statement >( else_ );
    335         node->orelse.condition  = notZeroExpr( maybeMoveBuild<Expression>( else_when ) );
     330        node->timeout.time      = maybeMoveBuild( timeout );
     331        node->timeout.statement = maybeMoveBuild( stmt    );
     332        node->timeout.condition = notZeroExpr( maybeMoveBuild( when ) );
     333
     334        node->orelse.statement  = maybeMoveBuild( else_ );
     335        node->orelse.condition  = notZeroExpr( maybeMoveBuild( else_when ) );
    336336
    337337        return node;
     
    341341        list< Expression * > e;
    342342        buildMoveList( exprs, e );
    343         Statement * s = maybeMoveBuild<Statement>( stmt );
     343        Statement * s = maybeMoveBuild( stmt );
    344344        return new DeclStmt( new WithStmt( e, s ) );
    345345} // build_with
     
    384384        list< Expression * > expList;
    385385        buildMoveList( exprs, expList );
    386         Statement * body = maybeMoveBuild<Statement>( stmt );
     386        Statement * body = maybeMoveBuild( stmt );
    387387        return new MutexStmt( body, expList );
    388388} // build_mutex
Note: See TracChangeset for help on using the changeset viewer.