Changes in src/SynTree/Statement.cc [ca78437:b3c36f4]
- File:
- 
      - 1 edited
 
 - 
          
  src/SynTree/Statement.cc (modified) (7 diffs)
 
Legend:
- Unmodified
- Added
- Removed
- 
      src/SynTree/Statement.ccrca78437 rb3c36f4 9 9 // Author : Richard C. Bilson 10 10 // Created On : Mon May 18 07:44:20 2015 11 // Last Modified By : Andrew Beach12 // Last Modified On : Mon Jun 12 10:37:00 201713 // Update Count : 6 411 // Last Modified By : Peter A. Buhr 12 // Last Modified On : Fri Aug 12 13:58:48 2016 13 // Update Count : 62 14 14 // 15 15 … … 101 101 } 102 102 103 ReturnStmt::ReturnStmt( std::list<Label> labels, Expression *_expr ) : Statement( labels ), expr( _expr) {}104 105 ReturnStmt::ReturnStmt( const ReturnStmt & other ) : Statement( other ), expr( maybeClone( other.expr ) ) {}103 ReturnStmt::ReturnStmt( std::list<Label> labels, Expression *_expr, bool throwP ) : Statement( labels ), expr( _expr ), isThrow( throwP ) {} 104 105 ReturnStmt::ReturnStmt( const ReturnStmt & other ) : Statement( other ), expr( maybeClone( other.expr ) ), isThrow( other.isThrow ) {} 106 106 107 107 ReturnStmt::~ReturnStmt() { … … 110 110 111 111 void ReturnStmt::print( std::ostream &os, int indent ) const { 112 os << "ReturnStatement, returning: ";112 os << string ( isThrow? "Throw":"Return" ) << " Statement, returning: "; 113 113 if ( expr != 0 ) { 114 114 os << endl << string( indent+2, ' ' ); … … 287 287 } 288 288 289 ThrowStmt::ThrowStmt( std::list<Label> labels, Kind kind, Expression * expr, Expression * target ) :290 Statement( labels ), kind(kind), expr(expr), target(target) {291 assertf(Resume == kind || nullptr == target, "Non-local termination throw is not accepted." );292 }293 294 ThrowStmt::ThrowStmt( const ThrowStmt &other ) :295 Statement ( other ), kind( other.kind ), expr( maybeClone( other.expr ) ), target( maybeClone( other.target ) ) {296 }297 298 ThrowStmt::~ThrowStmt() {299 delete expr;300 delete target;301 }302 303 void ThrowStmt::print( std::ostream &os, int indent) const {304 if ( target ) {305 os << "Non-Local ";306 }307 os << "Throw Statement, raising: ";308 expr->print(os, indent + 4);309 if ( target ) {310 os << "At: ";311 target->print(os, indent + 4);312 }313 }314 315 289 TryStmt::TryStmt( std::list<Label> labels, CompoundStmt *tryBlock, std::list<Statement *> &_handlers, FinallyStmt *_finallyBlock ) : 316 290 Statement( labels ), block( tryBlock ), handlers( _handlers ), finallyBlock( _finallyBlock ) { … … 344 318 } 345 319 346 CatchStmt::CatchStmt( std::list<Label> labels, Kind _kind, Declaration *_decl, Expression *_cond, Statement *_body ) :347 Statement( labels ), kind ( _kind ), decl ( _decl ), cond ( _cond ), body( _body ) {320 CatchStmt::CatchStmt( std::list<Label> labels, Declaration *_decl, Statement *_body, bool catchAny ) : 321 Statement( labels ), decl ( _decl ), body( _body ), catchRest ( catchAny ) { 348 322 } 349 323 350 324 CatchStmt::CatchStmt( const CatchStmt & other ) : 351 Statement( other ), kind ( other.kind ), decl ( maybeClone( other.decl ) ), cond ( maybeClone( other.cond ) ), body( maybeClone( other.body )) {325 Statement( other ), decl ( maybeClone( other.decl ) ), body( maybeClone( other.body ) ), catchRest ( other.catchRest ) { 352 326 } 353 327 … … 358 332 359 333 void CatchStmt::print( std::ostream &os, int indent ) const { 360 os << "Catch " << ((Terminate == kind) ? "Terminate" : "Resume") << "Statement" << endl;334 os << "Catch Statement" << endl; 361 335 362 336 os << string( indent, ' ' ) << "... catching" << endl; … … 364 338 decl->printShort( os, indent + 4 ); 365 339 os << endl; 366 } 340 } else if ( catchRest ) 341 os << string( indent + 4 , ' ' ) << "the rest" << endl; 367 342 else 368 343 os << string( indent + 4 , ' ' ) << ">>> Error: this catch clause must have a declaration <<<" << endl; 
  Note:
 See   TracChangeset
 for help on using the changeset viewer.
  