Ignore:
File:
1 edited

Legend:

Unmodified
Added
Removed
  • src/SynTree/Statement.cc

    r4e7171f r6cebfef  
    99// Author           : Richard C. Bilson
    1010// Created On       : Mon May 18 07:44:20 2015
    11 // Last Modified By : Peter A. Buhr
    12 // Last Modified On : Wed Feb  2 11:55:19 2022
    13 // Update Count     : 80
     11// Last Modified By : Andrew Beach
     12// Last Modified On : Mon Jan 20 16:03:00 2020
     13// Update Count     : 71
    1414//
    1515
     
    145145}
    146146
    147 IfStmt::IfStmt( Expression * condition, Statement * then, Statement * else_, std::list<Statement *> initialization ):
    148         Statement(), condition( condition ), then( then ), else_( else_ ), initialization( initialization ) {}
     147IfStmt::IfStmt( Expression * condition, Statement * thenPart, Statement * elsePart, std::list<Statement *> initialization ):
     148        Statement(), condition( condition ), thenPart( thenPart ), elsePart( elsePart ), initialization( initialization ) {}
    149149
    150150IfStmt::IfStmt( const IfStmt & other ) :
    151         Statement( other ), condition( maybeClone( other.condition ) ), then( maybeClone( other.then ) ), else_( maybeClone( other.else_ ) ) {
     151        Statement( other ), condition( maybeClone( other.condition ) ), thenPart( maybeClone( other.thenPart ) ), elsePart( maybeClone( other.elsePart ) ) {
    152152        cloneAll( other.initialization, initialization );
    153153}
     
    156156        deleteAll( initialization );
    157157        delete condition;
    158         delete then;
    159         delete else_;
     158        delete thenPart;
     159        delete elsePart;
    160160}
    161161
     
    177177
    178178        os << indent+1;
    179         then->print( os, indent+1 );
    180 
    181         if ( else_ != nullptr ) {
     179        thenPart->print( os, indent+1 );
     180
     181        if ( elsePart != nullptr ) {
    182182                os << indent << "... else: " << endl;
    183183                os << indent+1;
    184                 else_->print( os, indent+1 );
     184                elsePart->print( os, indent+1 );
    185185        } // if
    186186}
     
    246246}
    247247
    248 WhileDoStmt::WhileDoStmt( Expression * condition, Statement * body, const std::list< Statement * > & initialization, bool isDoWhile ):
    249         Statement(), condition( condition ), body( body ), else_( nullptr ), initialization( initialization ), isDoWhile( isDoWhile) {
    250 }
    251 
    252 WhileDoStmt::WhileDoStmt( Expression * condition, Statement * body, Statement * else_, const std::list< Statement * > & initialization, bool isDoWhile ):
    253         Statement(), condition( condition), body( body ), else_( else_ ), initialization( initialization ), isDoWhile( isDoWhile) {
    254 }
    255 
    256 WhileDoStmt::WhileDoStmt( const WhileDoStmt & other ):
     248WhileStmt::WhileStmt( Expression * condition, Statement * body, std::list< Statement * > & initialization, bool isDoWhile ):
     249        Statement(), condition( condition), body( body), initialization( initialization ), isDoWhile( isDoWhile) {
     250}
     251
     252WhileStmt::WhileStmt( const WhileStmt & other ):
    257253        Statement( other ), condition( maybeClone( other.condition ) ), body( maybeClone( other.body ) ), isDoWhile( other.isDoWhile ) {
    258254}
    259255
    260 WhileDoStmt::~WhileDoStmt() {
     256WhileStmt::~WhileStmt() {
    261257        delete body;
    262258        delete condition;
    263259}
    264260
    265 void WhileDoStmt::print( std::ostream & os, Indenter indent ) const {
     261void WhileStmt::print( std::ostream & os, Indenter indent ) const {
    266262        os << "While on condition: " << endl ;
    267263        condition->print( os, indent+1 );
     
    272268}
    273269
    274 ForStmt::ForStmt( std::list<Statement *> initialization, Expression * condition, Expression * increment, Statement * body, Statement * else_ ):
    275         Statement(), initialization( initialization ), condition( condition ), increment( increment ), body( body ), else_( else_ ) {
     270ForStmt::ForStmt( std::list<Statement *> initialization, Expression * condition, Expression * increment, Statement * body ):
     271        Statement(), initialization( initialization ), condition( condition ), increment( increment ), body( body ) {
    276272}
    277273
    278274ForStmt::ForStmt( const ForStmt & other ):
    279         Statement( other ), condition( maybeClone( other.condition ) ), increment( maybeClone( other.increment ) ), body( maybeClone( other.body ) ), else_( maybeClone( other.else_ ) ) {
     275        Statement( other ), condition( maybeClone( other.condition ) ), increment( maybeClone( other.increment ) ), body( maybeClone( other.body ) ) {
    280276                cloneAll( other.initialization, initialization );
    281277
     
    287283        delete increment;
    288284        delete body;
    289         delete else_;
    290285}
    291286
     
    316311                os << "\n" << indent << "... with body: \n" << indent+1;
    317312                body->print( os, indent+1 );
    318         }
    319 
    320         if ( else_ != nullptr ) {
    321                 os << "\n" << indent << "... with body: \n" << indent+1;
    322                 else_->print( os, indent+1 );
    323313        }
    324314        os << endl;
Note: See TracChangeset for help on using the changeset viewer.