Changeset 5e2c348 for src/SynTree
- Timestamp:
- Jan 31, 2018, 11:53:24 AM (7 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:
- 2cb70aa
- Parents:
- 5a73f0f
- Location:
- src/SynTree
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
src/SynTree/Expression.cc
r5a73f0f r5e2c348 597 597 598 598 StmtExpr::StmtExpr( CompoundStmt *statements ) : statements( statements ) { 599 computeResult(); 600 } 601 StmtExpr::StmtExpr( const StmtExpr &other ) : Expression( other ), statements( other.statements->clone() ) { 602 cloneAll( other.returnDecls, returnDecls ); 603 cloneAll( other.dtors, dtors ); 604 } 605 StmtExpr::~StmtExpr() { 606 delete statements; 607 deleteAll( dtors ); 608 deleteAll( returnDecls ); 609 } 610 void StmtExpr::computeResult() { 599 611 assert( statements ); 600 std::list< Statement * > & body = statements->get_kids(); 612 std::list< Statement * > & body = statements->kids; 613 delete result; 614 result = nullptr; 601 615 if ( ! body.empty() ) { 602 616 if ( ExprStmt * exprStmt = dynamic_cast< ExprStmt * >( body.back() ) ) { … … 608 622 result = new VoidType( Type::Qualifiers() ); 609 623 } 610 }611 StmtExpr::StmtExpr( const StmtExpr &other ) : Expression( other ), statements( other.statements->clone() ) {612 cloneAll( other.returnDecls, returnDecls );613 cloneAll( other.dtors, dtors );614 }615 StmtExpr::~StmtExpr() {616 delete statements;617 deleteAll( dtors );618 deleteAll( returnDecls );619 624 } 620 625 void StmtExpr::print( std::ostream &os, Indenter indent ) const { -
src/SynTree/Expression.h
r5a73f0f r5e2c348 728 728 StmtExpr * set_statements( CompoundStmt * newValue ) { statements = newValue; return this; } 729 729 730 // call to set the result type of this StmtExpr based on its body 731 void computeResult(); 732 730 733 std::list< ObjectDecl * > & get_returnDecls() { return returnDecls; } 731 734 std::list< Expression * > & get_dtors() { return dtors; }
Note: See TracChangeset
for help on using the changeset viewer.