Changeset ca78437 for src/SynTree
- Timestamp:
- Jun 12, 2017, 1:41:06 PM (8 years ago)
- Branches:
- ADT, aaron-thesis, arm-eh, ast-experimental, cleanup-dtors, deferred_resn, demangler, enum, forall-pointer-decay, jacob/cs343-translation, jenkins-sandbox, master, new-ast, new-ast-unique-expr, new-env, no_list, persistent-indexer, pthread-emulation, qualifiedEnum, resolv-new, with_gc
- Children:
- 465ed18
- Parents:
- cfaabe2c
- Location:
- src/SynTree
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
src/SynTree/Statement.cc
rcfaabe2c rca78437 10 10 // Created On : Mon May 18 07:44:20 2015 11 11 // Last Modified By : Andrew Beach 12 // Last Modified On : Thr Jun 08 16:22:00 201713 // Update Count : 6 312 // Last Modified On : Mon Jun 12 10:37:00 2017 13 // Update Count : 64 14 14 // 15 15 … … 344 344 } 345 345 346 CatchStmt::CatchStmt( std::list<Label> labels, Declaration *_decl, Statement *_body, bool catchAny ) :347 Statement( labels ), decl ( _decl ), body( _body ), catchRest ( catchAny ) {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 ) { 348 348 } 349 349 350 350 CatchStmt::CatchStmt( const CatchStmt & other ) : 351 Statement( other ), decl ( maybeClone( other.decl ) ), body( maybeClone( other.body ) ), catchRest ( other.catchRest) {351 Statement( other ), kind ( other.kind ), decl ( maybeClone( other.decl ) ), cond ( maybeClone( other.cond ) ), body( maybeClone( other.body ) ) { 352 352 } 353 353 … … 358 358 359 359 void CatchStmt::print( std::ostream &os, int indent ) const { 360 os << "Catch Statement" << endl;360 os << "Catch " << ((Terminate == kind) ? "Terminate" : "Resume") << " Statement" << endl; 361 361 362 362 os << string( indent, ' ' ) << "... catching" << endl; … … 364 364 decl->printShort( os, indent + 4 ); 365 365 os << endl; 366 } else if ( catchRest ) 367 os << string( indent + 4 , ' ' ) << "the rest" << endl; 366 } 368 367 else 369 368 os << string( indent + 4 , ' ' ) << ">>> Error: this catch clause must have a declaration <<<" << endl; -
src/SynTree/Statement.h
rcfaabe2c rca78437 10 10 // Created On : Mon May 18 07:44:20 2015 11 11 // Last Modified By : Andrew Beach 12 // Last Modified On : Thr Jun 08 18:39:00 201713 // Update Count : 6 612 // Last Modified On : Mon Jun 12 13:35:00 2017 13 // Update Count : 67 14 14 // 15 15 … … 293 293 enum Kind { Terminate, Resume }; 294 294 295 ThrowStmt( std::list<Label> labels, Kind kind, Expression * expr, 296 Expression * target = nullptr ); 295 ThrowStmt( std::list<Label> labels, Kind kind, Expression * expr, Expression * target = nullptr ); 297 296 ThrowStmt( const ThrowStmt &other ); 298 297 virtual ~ThrowStmt(); 299 300 298 301 299 Kind get_kind() { return kind; } … … 341 339 class CatchStmt : public Statement { 342 340 public: 343 CatchStmt( std::list<Label> labels, Declaration *decl, Statement *body, bool catchAny = false ); 341 enum Kind { Terminate, Resume }; 342 343 CatchStmt( std::list<Label> labels, Kind kind, Declaration *decl, 344 Expression *cond, Statement *body ); 344 345 CatchStmt( const CatchStmt &other ); 345 346 virtual ~CatchStmt(); 346 347 348 Kind get_kind() { return kind; } 347 349 Declaration *get_decl() { return decl; } 348 350 void set_decl( Declaration *newValue ) { decl = newValue; } 349 351 Expression *get_cond() { return cond; } 352 void set_cond( Expression *newCond ) { cond = newCond; } 350 353 Statement *get_body() { return body; } 351 354 void set_body( Statement *newValue ) { body = newValue; } … … 357 360 358 361 private: 362 Kind kind; 359 363 Declaration *decl; 364 Expression *cond; 360 365 Statement *body; 361 bool catchRest;362 366 }; 363 367
Note: See TracChangeset
for help on using the changeset viewer.