Ignore:
Timestamp:
Mar 30, 2023, 4:05:59 PM (2 years ago)
Author:
caparson <caparson@…>
Branches:
ADT, ast-experimental, master
Children:
bd72c284
Parents:
d24b1985 (diff), ff443e5 (diff)
Note: this is a merge changeset, the changes displayed below correspond to the merge itself.
Use the (diff) links above to see all the changes relative to each parent.
Message:

Merge branch 'master' of plg.uwaterloo.ca:software/cfa/cfa-cc

File:
1 edited

Legend:

Unmodified
Added
Removed
  • src/Parser/StatementNode.cc

    rd24b1985 r9082d7e8  
    1111// Created On       : Sat May 16 14:59:41 2015
    1212// Last Modified By : Peter A. Buhr
    13 // Last Modified On : Wed Feb  2 20:29:30 2022
    14 // Update Count     : 425
     13// Last Modified On : Wed Mar 29 08:51:23 2023
     14// Update Count     : 454
    1515//
    1616
     
    268268
    269269        return node;
    270 }
    271 
    272 WaitForStmt * build_waitfor( ExpressionNode * targetExpr, StatementNode * stmt, ExpressionNode * when ) {
    273         auto node = new WaitForStmt();
    274 
     270} // build_suspend
     271
     272WaitForStmt * build_waitfor( WaitForStmt * existing, ExpressionNode * when, ExpressionNode * targetExpr, StatementNode * stmt ) {
    275273        WaitForStmt::Target target;
    276274        target.function = maybeBuild( targetExpr );
     
    282280        delete targetExpr;
    283281
    284         node->clauses.push_back( WaitForStmt::Clause{
    285                 target,
    286                 maybeMoveBuild( stmt ),
    287                 notZeroExpr( maybeMoveBuild( when ) )
    288         });
    289 
    290         return node;
    291 } // build_waitfor
    292 
    293 WaitForStmt * build_waitfor( ExpressionNode * targetExpr, StatementNode * stmt, ExpressionNode * when, WaitForStmt * node ) {
    294         WaitForStmt::Target target;
    295         target.function = maybeBuild( targetExpr );
    296 
    297         ExpressionNode * next = dynamic_cast<ExpressionNode *>( targetExpr->get_next() );
    298         targetExpr->set_next( nullptr );
    299         buildMoveList< Expression >( next, target.arguments );
    300 
    301         delete targetExpr;
    302 
    303         node->clauses.insert( node->clauses.begin(), WaitForStmt::Clause{
     282        existing->clauses.insert( existing->clauses.begin(), WaitForStmt::Clause{
    304283                std::move( target ),
    305284                maybeMoveBuild( stmt ),
     
    307286        });
    308287
    309         return node;
     288        return existing;
    310289} // build_waitfor
    311290
    312 WaitForStmt * build_waitfor_timeout( ExpressionNode * timeout, StatementNode * stmt, ExpressionNode * when ) {
    313         auto node = new WaitForStmt();
    314 
    315         if( timeout ) {
    316                 node->timeout.time      = maybeMoveBuild( timeout );
    317                 node->timeout.statement = maybeMoveBuild( stmt    );
    318                 node->timeout.condition = notZeroExpr( maybeMoveBuild( when ) );
    319         } else {
    320                 node->orelse.statement  = maybeMoveBuild( stmt );
    321                 node->orelse.condition  = notZeroExpr( maybeMoveBuild( when ) );
    322         } // if
    323 
    324         return node;
    325 } // build_waitfor_timeout
    326 
    327 WaitForStmt * build_waitfor_timeout( ExpressionNode * timeout, StatementNode * stmt, ExpressionNode * when,  StatementNode * else_, ExpressionNode * else_when ) {
    328         auto node = new WaitForStmt();
    329 
    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 ) );
    336 
    337         return node;
     291WaitForStmt * build_waitfor_else( WaitForStmt * existing, ExpressionNode * when, StatementNode * stmt ) {
     292        existing->orelse.statement  = maybeMoveBuild( stmt );
     293        existing->orelse.condition  = notZeroExpr( maybeMoveBuild( when ) );
     294
     295        return existing;
     296} // build_waitfor_else
     297
     298WaitForStmt * build_waitfor_timeout( WaitForStmt * existing, ExpressionNode * when, ExpressionNode * timeout, StatementNode * stmt ) {
     299        existing->timeout.time      = maybeMoveBuild( timeout );
     300        existing->timeout.statement = maybeMoveBuild( stmt );
     301        existing->timeout.condition = notZeroExpr( maybeMoveBuild( when ) );
     302
     303        return existing;
    338304} // build_waitfor_timeout
    339305
Note: See TracChangeset for help on using the changeset viewer.