Changeset 400b8be for src/AST/Convert.cpp
- Timestamp:
- Mar 28, 2022, 10:41:45 AM (2 years ago)
- Branches:
- ADT, ast-experimental, enum, master, pthread-emulation, qualifiedEnum
- Children:
- 8e819a9
- Parents:
- f5bace8
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
src/AST/Convert.cpp
rf5bace8 r400b8be 353 353 } 354 354 355 void clausePostamble( Statement * stmt, const ast::StmtClause * node ) { 356 stmt->location = node->location; 357 this->node = stmt; 358 } 359 355 360 const ast::CompoundStmt * visit( const ast::CompoundStmt * node ) override final { 356 361 if ( inCache( node ) ) return nullptr; … … 401 406 auto stmt = new SwitchStmt( 402 407 get<Expression>().accept1( node->cond ), 403 get<Statement>().acceptL( node-> stmts )408 get<Statement>().acceptL( node->cases ) 404 409 ); 405 410 return stmtPostamble( stmt, node ); 406 411 } 407 412 408 const ast:: Stmt * visit( const ast::CaseStmt* node ) override final {413 const ast::CaseClause * visit( const ast::CaseClause * node ) override final { 409 414 if ( inCache( node ) ) return nullptr; 410 415 auto stmt = new CaseStmt( … … 413 418 node->isDefault() 414 419 ); 415 return stmtPostamble( stmt, node ); 420 clausePostamble( stmt, node ); 421 return nullptr; 416 422 } 417 423 … … 509 515 } 510 516 511 const ast:: Stmt * visit( const ast::CatchStmt* node ) override final {517 const ast::CatchClause * visit( const ast::CatchClause * node ) override final { 512 518 if ( inCache( node ) ) return nullptr; 513 519 CatchStmt::Kind kind; … … 520 526 break; 521 527 default: 522 assertf(false, "Invalid ast:: CatchStmt::Kind: %d\n", node->kind);528 assertf(false, "Invalid ast::ExceptionKind: %d\n", node->kind); 523 529 } 524 530 auto stmt = new CatchStmt( … … 528 534 get<Statement>().accept1( node->body ) 529 535 ); 530 return stmtPostamble( stmt, node );531 } 532 533 const ast:: Stmt * visit( const ast::FinallyStmt* node ) override final {536 return clausePostamble( stmt, node ), nullptr; 537 } 538 539 const ast::FinallyClause * visit( const ast::FinallyClause * node ) override final { 534 540 if ( inCache( node ) ) return nullptr; 535 541 auto stmt = new FinallyStmt( get<CompoundStmt>().accept1( node->body ) ); 536 return stmtPostamble( stmt, node );542 return clausePostamble( stmt, node ), nullptr; 537 543 } 538 544 … … 1884 1890 old->location, 1885 1891 GET_ACCEPT_1(condition, Expr), 1886 GET_ACCEPT_V(statements, Stmt),1892 GET_ACCEPT_V(statements, CaseClause), 1887 1893 GET_LABELS_V(old->labels) 1888 1894 ); … … 1892 1898 virtual void visit( const CaseStmt * old ) override final { 1893 1899 if ( inCache( old ) ) return; 1894 this->node = new ast::Case Stmt(1900 this->node = new ast::CaseClause( 1895 1901 old->location, 1896 1902 GET_ACCEPT_1(condition, Expr), 1897 GET_ACCEPT_V(stmts, Stmt), 1898 GET_LABELS_V(old->labels) 1899 ); 1903 GET_ACCEPT_V(stmts, Stmt) 1904 ); 1905 auto labels = GET_LABELS_V(old->labels); 1906 assertf(labels.empty(), "Labels found on CaseStmt."); 1900 1907 cache.emplace( old, this->node ); 1901 1908 } … … 2005 2012 old->location, 2006 2013 GET_ACCEPT_1(block, CompoundStmt), 2007 GET_ACCEPT_V(handlers, Catch Stmt),2008 GET_ACCEPT_1(finallyBlock, Finally Stmt),2014 GET_ACCEPT_V(handlers, CatchClause), 2015 GET_ACCEPT_1(finallyBlock, FinallyClause), 2009 2016 GET_LABELS_V(old->labels) 2010 2017 ); … … 2026 2033 } 2027 2034 2028 this->node = new ast::Catch Stmt(2035 this->node = new ast::CatchClause( 2029 2036 old->location, 2030 2037 kind, 2031 2038 GET_ACCEPT_1(decl, Decl), 2032 2039 GET_ACCEPT_1(cond, Expr), 2033 GET_ACCEPT_1(body, Stmt), 2034 GET_LABELS_V(old->labels) 2035 ); 2040 GET_ACCEPT_1(body, Stmt) 2041 ); 2042 auto labels = GET_LABELS_V(old->labels); 2043 assertf(labels.empty(), "Labels found on CatchStmt."); 2036 2044 cache.emplace( old, this->node ); 2037 2045 } … … 2039 2047 virtual void visit( const FinallyStmt * old ) override final { 2040 2048 if ( inCache( old ) ) return; 2041 this->node = new ast::FinallyStmt( 2042 old->location, 2043 GET_ACCEPT_1(block, CompoundStmt), 2044 GET_LABELS_V(old->labels) 2045 ); 2049 this->node = new ast::FinallyClause( 2050 old->location, 2051 GET_ACCEPT_1(block, CompoundStmt) 2052 ); 2053 auto labels = GET_LABELS_V(old->labels); 2054 assertf(labels.empty(), "Labels found on FinallyStmt."); 2046 2055 cache.emplace( old, this->node ); 2047 2056 }
Note: See TracChangeset
for help on using the changeset viewer.