Changeset 400b8be for src/ResolvExpr
- Timestamp:
- Mar 28, 2022, 10:41:45 AM (3 years ago)
- Branches:
- ADT, ast-experimental, enum, master, pthread-emulation, qualifiedEnum
- Children:
- 8e819a9
- Parents:
- f5bace8
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
TabularUnified src/ResolvExpr/Resolver.cc ¶
rf5bace8 r400b8be 1281 1281 const ast::ForStmt * previsit( const ast::ForStmt * ); 1282 1282 const ast::SwitchStmt * previsit( const ast::SwitchStmt * ); 1283 const ast::Case Stmt * previsit( const ast::CaseStmt* );1283 const ast::CaseClause * previsit( const ast::CaseClause * ); 1284 1284 const ast::BranchStmt * previsit( const ast::BranchStmt * ); 1285 1285 const ast::ReturnStmt * previsit( const ast::ReturnStmt * ); 1286 1286 const ast::ThrowStmt * previsit( const ast::ThrowStmt * ); 1287 const ast::Catch Stmt * previsit( const ast::CatchStmt* );1288 const ast::Catch Stmt * postvisit( const ast::CatchStmt* );1287 const ast::CatchClause * previsit( const ast::CatchClause * ); 1288 const ast::CatchClause * postvisit( const ast::CatchClause * ); 1289 1289 const ast::WaitForStmt * previsit( const ast::WaitForStmt * ); 1290 1290 const ast::WithStmt * previsit( const ast::WithStmt * ); … … 1615 1615 } 1616 1616 1617 const ast::Case Stmt * Resolver_new::previsit( const ast::CaseStmt* caseStmt ) {1617 const ast::CaseClause * Resolver_new::previsit( const ast::CaseClause * caseStmt ) { 1618 1618 if ( caseStmt->cond ) { 1619 1619 std::deque< ast::InitAlternative > initAlts = currentObject.getOptions(); … … 1631 1631 } 1632 1632 1633 caseStmt = ast::mutate_field( caseStmt, &ast::Case Stmt::cond, newExpr );1633 caseStmt = ast::mutate_field( caseStmt, &ast::CaseClause::cond, newExpr ); 1634 1634 } 1635 1635 return caseStmt; … … 1674 1674 } 1675 1675 1676 const ast::Catch Stmt * Resolver_new::previsit( const ast::CatchStmt * catchStmt) {1676 const ast::CatchClause * Resolver_new::previsit( const ast::CatchClause * catchClause ) { 1677 1677 // Until we are very sure this invarent (ifs that move between passes have then) 1678 1678 // holds, check it. This allows a check for when to decode the mangling. 1679 if ( auto ifStmt = catch Stmt->body.as<ast::IfStmt>() ) {1679 if ( auto ifStmt = catchClause->body.as<ast::IfStmt>() ) { 1680 1680 assert( ifStmt->then ); 1681 1681 } 1682 1682 // Encode the catchStmt so the condition can see the declaration. 1683 if ( catch Stmt->cond ) {1684 ast::Catch Stmt * stmt = mutate( catchStmt);1685 stmt->body = new ast::IfStmt( stmt->location, stmt->cond, nullptr, stmt->body );1686 stmt->cond = nullptr;1687 return stmt;1688 } 1689 return catch Stmt;1690 } 1691 1692 const ast::Catch Stmt * Resolver_new::postvisit( const ast::CatchStmt * catchStmt) {1683 if ( catchClause->cond ) { 1684 ast::CatchClause * clause = mutate( catchClause ); 1685 clause->body = new ast::IfStmt( clause->location, clause->cond, nullptr, clause->body ); 1686 clause->cond = nullptr; 1687 return clause; 1688 } 1689 return catchClause; 1690 } 1691 1692 const ast::CatchClause * Resolver_new::postvisit( const ast::CatchClause * catchClause ) { 1693 1693 // Decode the catchStmt so everything is stored properly. 1694 const ast::IfStmt * ifStmt = catch Stmt->body.as<ast::IfStmt>();1694 const ast::IfStmt * ifStmt = catchClause->body.as<ast::IfStmt>(); 1695 1695 if ( nullptr != ifStmt && nullptr == ifStmt->then ) { 1696 1696 assert( ifStmt->cond ); 1697 1697 assert( ifStmt->else_ ); 1698 ast::Catch Stmt * stmt = ast::mutate( catchStmt);1699 stmt->cond = ifStmt->cond;1700 stmt->body = ifStmt->else_;1698 ast::CatchClause * clause = ast::mutate( catchClause ); 1699 clause->cond = ifStmt->cond; 1700 clause->body = ifStmt->else_; 1701 1701 // ifStmt should be implicately deleted here. 1702 return stmt;1703 } 1704 return catch Stmt;1702 return clause; 1703 } 1704 return catchClause; 1705 1705 } 1706 1706
Note: See TracChangeset
for help on using the changeset viewer.