Changes in src/SynTree/Statement.cc [4e7171f:6cebfef]
- File:
-
- 1 edited
-
src/SynTree/Statement.cc (modified) (8 diffs)
Legend:
- Unmodified
- Added
- Removed
-
src/SynTree/Statement.cc
r4e7171f r6cebfef 9 9 // Author : Richard C. Bilson 10 10 // Created On : Mon May 18 07:44:20 2015 11 // Last Modified By : Peter A. Buhr12 // Last Modified On : Wed Feb 2 11:55:19 202213 // Update Count : 8011 // Last Modified By : Andrew Beach 12 // Last Modified On : Mon Jan 20 16:03:00 2020 13 // Update Count : 71 14 14 // 15 15 … … 145 145 } 146 146 147 IfStmt::IfStmt( Expression * condition, Statement * then , Statement * else_, std::list<Statement *> initialization ):148 Statement(), condition( condition ), then ( then ), else_( else_), initialization( initialization ) {}147 IfStmt::IfStmt( Expression * condition, Statement * thenPart, Statement * elsePart, std::list<Statement *> initialization ): 148 Statement(), condition( condition ), thenPart( thenPart ), elsePart( elsePart ), initialization( initialization ) {} 149 149 150 150 IfStmt::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 ) ) { 152 152 cloneAll( other.initialization, initialization ); 153 153 } … … 156 156 deleteAll( initialization ); 157 157 delete condition; 158 delete then ;159 delete else _;158 delete thenPart; 159 delete elsePart; 160 160 } 161 161 … … 177 177 178 178 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 ) { 182 182 os << indent << "... else: " << endl; 183 183 os << indent+1; 184 else _->print( os, indent+1 );184 elsePart->print( os, indent+1 ); 185 185 } // if 186 186 } … … 246 246 } 247 247 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 ): 248 WhileStmt::WhileStmt( Expression * condition, Statement * body, std::list< Statement * > & initialization, bool isDoWhile ): 249 Statement(), condition( condition), body( body), initialization( initialization ), isDoWhile( isDoWhile) { 250 } 251 252 WhileStmt::WhileStmt( const WhileStmt & other ): 257 253 Statement( other ), condition( maybeClone( other.condition ) ), body( maybeClone( other.body ) ), isDoWhile( other.isDoWhile ) { 258 254 } 259 255 260 While DoStmt::~WhileDoStmt() {256 WhileStmt::~WhileStmt() { 261 257 delete body; 262 258 delete condition; 263 259 } 264 260 265 void While DoStmt::print( std::ostream & os, Indenter indent ) const {261 void WhileStmt::print( std::ostream & os, Indenter indent ) const { 266 262 os << "While on condition: " << endl ; 267 263 condition->print( os, indent+1 ); … … 272 268 } 273 269 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_ ){270 ForStmt::ForStmt( std::list<Statement *> initialization, Expression * condition, Expression * increment, Statement * body ): 271 Statement(), initialization( initialization ), condition( condition ), increment( increment ), body( body ) { 276 272 } 277 273 278 274 ForStmt::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 ) ) { 280 276 cloneAll( other.initialization, initialization ); 281 277 … … 287 283 delete increment; 288 284 delete body; 289 delete else_;290 285 } 291 286 … … 316 311 os << "\n" << indent << "... with body: \n" << indent+1; 317 312 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 );323 313 } 324 314 os << endl;
Note:
See TracChangeset
for help on using the changeset viewer.