Ignore:
Timestamp:
Sep 23, 2024, 11:08:40 PM (6 weeks ago)
Author:
Peter A. Buhr <pabuhr@…>
Branches:
master
Children:
569b118
Parents:
fca78f1
Message:

fformatting, make names consistent

File:
1 edited

Legend:

Unmodified
Added
Removed
  • src/Parser/StatementNode.cpp

    rfca78f1 r738a9b4  
    1111// Created On       : Sat May 16 14:59:41 2015
    1212// Last Modified By : Peter A. Buhr
    13 // Last Modified On : Mon Sep  9 21:49:15 2024
    14 // Update Count     : 431
     13// Last Modified On : Mon Sep 23 22:50:35 2024
     14// Update Count     : 432
    1515//
    1616
     
    105105} // ClauseNode::append_last_case
    106106
    107 ast::Stmt * build_expr( CodeLocation const & location, ExpressionNode * ctl ) {
    108         if ( ast::Expr * e = maybeMoveBuild( ctl ) ) {
     107ast::Stmt * build_expr( CodeLocation const & location, ExpressionNode * ctrl ) {
     108        if ( ast::Expr * e = maybeMoveBuild( ctrl ) ) {
    109109                return new ast::ExprStmt( location, e );
    110110        } else {
     
    113113} // build_expr
    114114
    115 static ast::Expr * build_if_control( CondCtl * ctl,
     115static ast::Expr * build_if_control( CondCtrl * ctrl,
    116116                std::vector<ast::ptr<ast::Stmt>> & inits ) {
    117117        assert( inits.empty() );
    118         if ( nullptr != ctl->init ) {
    119                 buildMoveList( ctl->init, inits );
     118        if ( nullptr != ctrl->init ) {
     119                buildMoveList( ctrl->init, inits );
    120120        } // if
    121121
    122122        ast::Expr * cond = nullptr;
    123         if ( ctl->condition ) {
    124                 cond = maybeMoveBuild( ctl->condition );
     123        if ( ctrl->condition ) {
     124                cond = maybeMoveBuild( ctrl->condition );
    125125        } else {
    126126                for ( ast::ptr<ast::Stmt> & stmt : inits ) {
     
    132132                }
    133133        }
    134         delete ctl;
     134        delete ctrl;
    135135        return cond;
    136136} // build_if_control
    137137
    138 ast::Stmt * build_if( const CodeLocation & location, CondCtl * ctl, StatementNode * then, StatementNode * else_ ) {
    139         std::vector<ast::ptr<ast::Stmt>> astinit;                                               // maybe empty
    140         ast::Expr * astcond = build_if_control( ctl, astinit ); // ctl deleted, cond/init set
     138ast::Stmt * build_if( const CodeLocation & location, CondCtrl * ctrl, StatementNode * then, StatementNode * else_ ) {
     139        std::vector<ast::ptr<ast::Stmt>> astinit;                       // maybe empty
     140        ast::Expr * astcond = build_if_control( ctrl, astinit ); // ctrl deleted, cond/init set
    141141
    142142        ast::Stmt const * astthen = buildMoveSingle( then );
     
    148148} // build_if
    149149
    150 ast::Stmt * build_switch( const CodeLocation & location, bool isSwitch, ExpressionNode * ctl, ClauseNode * stmt ) {
     150ast::Stmt * build_switch( const CodeLocation & location, bool isSwitch, ExpressionNode * ctrl, ClauseNode * stmt ) {
    151151        std::vector<ast::ptr<ast::CaseClause>> aststmt;
    152152        buildMoveList( stmt, aststmt );
     
    169169        // aststmt.size() == 0 for switch (...) {}, i.e., no declaration or statements
    170170        return new ast::SwitchStmt( location,
    171                 maybeMoveBuild( ctl ), std::move( aststmt ) );
     171                maybeMoveBuild( ctrl ), std::move( aststmt ) );
    172172} // build_switch
    173173
    174 ast::CaseClause * build_case( const CodeLocation & location, ExpressionNode * ctl ) {
     174ast::CaseClause * build_case( const CodeLocation & location, ExpressionNode * ctrl ) {
    175175        // stmt starts empty and then added to
    176         auto expr = maybeMoveBuild( ctl );
     176        auto expr = maybeMoveBuild( ctrl );
    177177        return new ast::CaseClause( location, expr, {} );
    178178} // build_case
     
    183183} // build_default
    184184
    185 ast::Stmt * build_while( const CodeLocation & location, CondCtl * ctl, StatementNode * stmt, StatementNode * else_ ) {
     185ast::Stmt * build_while( const CodeLocation & location, CondCtrl * ctrl, StatementNode * stmt, StatementNode * else_ ) {
    186186        std::vector<ast::ptr<ast::Stmt>> astinit;                       // maybe empty
    187         ast::Expr * astcond = build_if_control( ctl, astinit ); // ctl deleted, cond/init set
     187        ast::Expr * astcond = build_if_control( ctrl, astinit ); // ctrl deleted, cond/init set
    188188
    189189        return new ast::WhileDoStmt( location,
     
    196196} // build_while
    197197
    198 ast::Stmt * build_do_while( const CodeLocation & location, ExpressionNode * ctl, StatementNode * stmt, StatementNode * else_ ) {
     198ast::Stmt * build_do_while( const CodeLocation & location, ExpressionNode * ctrl, StatementNode * stmt, StatementNode * else_ ) {
    199199        // do-while cannot have declarations in the contitional, so init is always empty
    200200        return new ast::WhileDoStmt( location,
    201                 maybeMoveBuild( ctl ),
     201                maybeMoveBuild( ctrl ),
    202202                buildMoveSingle( stmt ),
    203203                buildMoveOptional( else_ ),
     
    207207} // build_do_while
    208208
    209 ast::Stmt * build_for( const CodeLocation & location, ForCtrl * forctl, StatementNode * stmt, StatementNode * else_ ) {
     209ast::Stmt * build_for( const CodeLocation & location, ForCtrl * forctrl, StatementNode * stmt, StatementNode * else_ ) {
    210210        std::vector<ast::ptr<ast::Stmt>> astinit;                       // maybe empty
    211         buildMoveList( forctl->init, astinit );
    212 
    213         if ( forctl->range_over ) {
    214                 ast::Expr * range_over = maybeMoveBuild( forctl->range_over );
    215                 bool isIncreasing = forctl->kind == OperKinds::LEThan;
     211        buildMoveList( forctrl->init, astinit );
     212
     213        if ( forctrl->range_over ) {
     214                ast::Expr * range_over = maybeMoveBuild( forctrl->range_over );
     215                bool isIncreasing = forctrl->kind == OperKinds::LEThan;
    216216                // Copy all the data needed before the delete.
    217                 delete forctl;
     217                delete forctrl;
    218218                return new ast::ForeachStmt( location,
    219219                        std::move( astinit ),
     
    226226
    227227        ast::Expr * astcond = nullptr;                                          // maybe empty
    228         astcond = maybeMoveBuild( forctl->condition );
     228        astcond = maybeMoveBuild( forctrl->condition );
    229229
    230230        ast::Expr * astincr = nullptr;                                          // maybe empty
    231         astincr = maybeMoveBuild( forctl->change );
    232         delete forctl;
     231        astincr = maybeMoveBuild( forctrl->change );
     232        delete forctrl;
    233233
    234234        return new ast::ForStmt( location,
     
    257257} // build_branch
    258258
    259 ast::Stmt * build_computedgoto( ExpressionNode * ctl ) {
    260         ast::Expr * expr = maybeMoveBuild( ctl );
     259ast::Stmt * build_computedgoto( ExpressionNode * ctrl ) {
     260        ast::Expr * expr = maybeMoveBuild( ctrl );
    261261        return new ast::BranchStmt( expr->location, expr );
    262262} // build_computedgoto
    263263
    264 ast::Stmt * build_return( const CodeLocation & location, ExpressionNode * ctl ) {
     264ast::Stmt * build_return( const CodeLocation & location, ExpressionNode * ctrl ) {
    265265        std::vector<ast::ptr<ast::Expr>> exps;
    266         buildMoveList( ctl, exps );
     266        buildMoveList( ctrl, exps );
    267267        return new ast::ReturnStmt( location,
    268268                exps.size() > 0 ? exps.back().release() : nullptr
     
    272272static ast::Stmt * build_throw_stmt(
    273273                const CodeLocation & location,
    274                 ExpressionNode * ctl,
     274                ExpressionNode * ctrl,
    275275                ast::ExceptionKind kind ) {
    276276        std::vector<ast::ptr<ast::Expr>> exps;
    277         buildMoveList( ctl, exps );
     277        buildMoveList( ctrl, exps );
    278278        assertf( exps.size() < 2, "CFA internal error: leaking memory" );
    279279        return new ast::ThrowStmt( location,
     
    284284}
    285285
    286 ast::Stmt * build_throw( const CodeLocation & loc, ExpressionNode * ctl ) {
    287         return build_throw_stmt( loc, ctl, ast::Terminate );
     286ast::Stmt * build_throw( const CodeLocation & loc, ExpressionNode * ctrl ) {
     287        return build_throw_stmt( loc, ctrl, ast::Terminate );
    288288} // build_throw
    289289
    290 ast::Stmt * build_resume( const CodeLocation & loc, ExpressionNode * ctl ) {
    291         return build_throw_stmt( loc, ctl, ast::Resume );
     290ast::Stmt * build_resume( const CodeLocation & loc, ExpressionNode * ctrl ) {
     291        return build_throw_stmt( loc, ctrl, ast::Resume );
    292292} // build_resume
    293293
    294 ast::Stmt * build_resume_at( ExpressionNode * ctl, ExpressionNode * target ) {
    295         (void)ctl;
     294ast::Stmt * build_resume_at( ExpressionNode * ctrl, ExpressionNode * target ) {
     295        (void)ctrl;
    296296        (void)target;
    297297        assertf( false, "resume at (non-local throw) is not yet supported," );
     
    516516} // build_corun
    517517
    518 ast::Stmt * build_cofor( const CodeLocation & location, ForCtrl * forctl, StatementNode * stmt ) {
     518ast::Stmt * build_cofor( const CodeLocation & location, ForCtrl * forctrl, StatementNode * stmt ) {
    519519        std::vector<ast::ptr<ast::Stmt>> astinit;                                               // maybe empty
    520         buildMoveList( forctl->init, astinit );
     520        buildMoveList( forctrl->init, astinit );
    521521
    522522        ast::Expr * astcond = nullptr;                                          // maybe empty
    523         astcond = maybeMoveBuild( forctl->condition );
     523        astcond = maybeMoveBuild( forctrl->condition );
    524524
    525525        ast::Expr * astincr = nullptr;                                          // maybe empty
    526         astincr = maybeMoveBuild( forctl->change );
    527         delete forctl;
     526        astincr = maybeMoveBuild( forctrl->change );
     527        delete forctrl;
    528528
    529529        return new ast::CoforStmt( location,
Note: See TracChangeset for help on using the changeset viewer.