- Timestamp:
- Oct 16, 2023, 8:09:51 AM (2 years ago)
- Branches:
- master
- Children:
- 2bf46a5, 54e59dd, 61e5d99
- Parents:
- 946a6e4 (diff), 8cbe732 (diff)
Note: this is a merge changeset, the changes displayed below correspond to the merge itself.
Use the(diff)links above to see all the changes relative to each parent. - Location:
- src/AST
- Files:
-
- 8 edited
Legend:
- Unmodified
- Added
- Removed
-
src/AST/Convert.cpp
r946a6e4 ra97b9ed 269 269 node->location, 270 270 Type::StorageClasses( node->storage.val ), 271 get<Type>().accept1( node->base ),271 get<Type>().accept1( node->base ), 272 272 LinkageSpec::Spec( node->linkage.val ) 273 273 ); … … 567 567 } 568 568 569 const ast::WhenClause * visit( const ast::WhenClause * node ) override final {569 const ast::WhenClause * visit( const ast::WhenClause * node ) override final { 570 570 // There is no old-AST WhenClause, so this should never be called. 571 571 assert( !node ); … … 604 604 } 605 605 606 const ast::Stmt * visit( const ast::WaitUntilStmt * node ) override final {607 // There is no old-AST WaitUntilStmt, so this should never be called.606 const ast::Stmt * visit( const ast::WaitUntilStmt * node ) override final { 607 // There is no old-AST WaitUntilStmt, so this should never be called. 608 608 assert( !node ); 609 609 return nullptr; … … 648 648 ); 649 649 return stmtPostamble( stmt, node ); 650 } 651 652 const ast::Stmt * visit( const ast::CorunStmt * node ) override final { 653 // There is no old-AST CorunStmt, so this should never be called. 654 assert( !node ); 655 return nullptr; 650 656 } 651 657 … … 853 859 // New workd: one public type: node->result, plus node->underlyer only to support roundtrip conversion 854 860 // preserving underlyer because the correct type for string literals is complicated to construct, 855 // and distinguishing a string from other literals using the type is hard to do accurately861 // and distinguishing a string from other literals using the type is hard to do accurately 856 862 // Both worlds: the outer, expression-level type can change during resolution 857 863 // for a string, that's char[k] before-resolve and char * after … … 859 865 // for a string, that's char[k] always 860 866 // Both worlds: the "rep" field of a constant is the C source file fragment that compiles to the desired value 861 // for a string, that includes outer quotes, backslashes, et al cases from the Literals test867 // for a string, that includes outer quotes, backslashes, et al cases from the Literals test 862 868 ConstantExpr *rslt = new ConstantExpr(Constant( 863 869 get<Type>().accept1(node->underlyer), … … 1518 1524 return strict_dynamic_cast< ast::Decl * >( node ); 1519 1525 } 1520 1526 1521 1527 ConverterOldToNew() = default; 1522 1528 ConverterOldToNew(const ConverterOldToNew &) = delete; … … 1581 1587 ast::Label make_label(const Label* old) { 1582 1588 CodeLocation const & location = 1583 ( old->labelled ) ? old->labelled->location : CodeLocation();1589 ( old->labelled ) ? old->labelled->location : CodeLocation(); 1584 1590 return ast::Label( 1585 1591 location, … … 2240 2246 // TypeSubstitution shouldn't exist yet in old. 2241 2247 ast::TypeSubstitution * convertTypeSubstitution(const TypeSubstitution * old) { 2242 2243 2248 if (!old) return nullptr; 2244 2249 if (old->empty()) return nullptr; … … 2285 2290 ast::Expr * visitBaseExpr_SkipResultType( const Expression * old, ast::Expr * nw) { 2286 2291 2287 nw->env = convertTypeSubstitution(old->env);2292 nw->env = convertTypeSubstitution(old->env); 2288 2293 2289 2294 nw->extension = old->extension; … … 2856 2861 2857 2862 virtual void visit( const EnumInstType * old ) override final { 2858 ast::EnumInstType * ty; 2863 ast::EnumInstType * ty; 2859 2864 if ( old->baseEnum ) { 2860 2865 ty = new ast::EnumInstType{ -
src/AST/Fwd.hpp
r946a6e4 ra97b9ed 67 67 class ImplicitCtorDtorStmt; 68 68 class MutexStmt; 69 class CorunStmt; 69 70 70 71 class Expr; -
src/AST/Node.cpp
r946a6e4 ra97b9ed 192 192 template class ast::ptr_base< ast::MutexStmt, ast::Node::ref_type::weak >; 193 193 template class ast::ptr_base< ast::MutexStmt, ast::Node::ref_type::strong >; 194 template class ast::ptr_base< ast::CorunStmt, ast::Node::ref_type::weak >; 195 template class ast::ptr_base< ast::CorunStmt, ast::Node::ref_type::strong >; 194 196 template class ast::ptr_base< ast::Expr, ast::Node::ref_type::weak >; 195 197 template class ast::ptr_base< ast::Expr, ast::Node::ref_type::strong >; -
src/AST/Pass.hpp
r946a6e4 ra97b9ed 162 162 const ast::FinallyClause * visit( const ast::FinallyClause * ) override final; 163 163 const ast::Stmt * visit( const ast::SuspendStmt * ) override final; 164 const ast::WhenClause * visit( const ast::WhenClause * ) override final;164 const ast::WhenClause * visit( const ast::WhenClause * ) override final; 165 165 const ast::Stmt * visit( const ast::WaitForStmt * ) override final; 166 166 const ast::WaitForClause * visit( const ast::WaitForClause * ) override final; 167 const ast::Stmt * visit( const ast::WaitUntilStmt * ) override final;167 const ast::Stmt * visit( const ast::WaitUntilStmt * ) override final; 168 168 const ast::Decl * visit( const ast::WithStmt * ) override final; 169 169 const ast::NullStmt * visit( const ast::NullStmt * ) override final; … … 171 171 const ast::Stmt * visit( const ast::ImplicitCtorDtorStmt * ) override final; 172 172 const ast::Stmt * visit( const ast::MutexStmt * ) override final; 173 const ast::Stmt * visit( const ast::CorunStmt * ) override final; 173 174 const ast::Expr * visit( const ast::ApplicationExpr * ) override final; 174 175 const ast::Expr * visit( const ast::UntypedExpr * ) override final; -
src/AST/Pass.impl.hpp
r946a6e4 ra97b9ed 1121 1121 1122 1122 //-------------------------------------------------------------------------- 1123 // CorunStmt 1124 template< typename core_t > 1125 const ast::Stmt * ast::Pass< core_t >::visit( const ast::CorunStmt * node ) { 1126 VISIT_START( node ); 1127 1128 if ( __visit_children() ) { 1129 maybe_accept( node, &CorunStmt::stmt ); 1130 } 1131 1132 VISIT_END( Stmt, node ); 1133 } 1134 1135 //-------------------------------------------------------------------------- 1123 1136 // ApplicationExpr 1124 1137 template< typename core_t > -
src/AST/Print.cpp
r946a6e4 ra97b9ed 209 209 } 210 210 211 void print( const ast::WaitStmt * node ) {211 void print( const ast::WaitStmt * node ) { 212 212 if ( node->timeout_time ) { 213 213 os << indent-1 << "timeout of:" << endl; … … 860 860 } 861 861 862 virtual const ast::Stmt * visit( const ast::WaitUntilStmt * node ) override final {862 virtual const ast::Stmt * visit( const ast::WaitUntilStmt * node ) override final { 863 863 os << "Waituntil Statement" << endl; 864 864 indent += 2; … … 866 866 clause->accept( *this ); 867 867 } 868 print(node); // calls print( const ast::WaitStmt * node ) 868 // calls print( const ast::WaitStmt * node ) 869 print(node); 869 870 return node; 870 871 } … … 913 914 printAll( node->mutexObjs ); 914 915 --indent; 916 os << indent << "... with Statement: "; 917 ++indent; 918 safe_print( node->stmt ); 919 --indent; 920 os << endl; 921 922 return node; 923 } 924 925 virtual const ast::Stmt * visit( const ast::CorunStmt * node ) override final { 926 os << "Corun Statement" << endl; 915 927 os << indent << "... with Statement: "; 916 928 ++indent; -
src/AST/Stmt.hpp
r946a6e4 ra97b9ed 532 532 }; 533 533 534 // Corun Statement 535 class CorunStmt final : public Stmt { 536 public: 537 ptr<Stmt> stmt; 538 539 CorunStmt( const CodeLocation & loc, const Stmt * stmt, const std::vector<Label> && labels = {} ) 540 : Stmt(loc, std::move(labels)), stmt(stmt) {} 541 542 const Stmt * accept( Visitor & v ) const override { return v.visit( this ); } 543 private: 544 CorunStmt * clone() const override { return new CorunStmt{ *this }; } 545 MUTATE_FRIEND 546 }; 547 534 548 } // namespace ast 535 549 -
src/AST/Visitor.hpp
r946a6e4 ra97b9ed 59 59 virtual const ast::Stmt * visit( const ast::ImplicitCtorDtorStmt * ) = 0; 60 60 virtual const ast::Stmt * visit( const ast::MutexStmt * ) = 0; 61 virtual const ast::Stmt * visit( const ast::CorunStmt * ) = 0; 61 62 virtual const ast::Expr * visit( const ast::ApplicationExpr * ) = 0; 62 63 virtual const ast::Expr * visit( const ast::UntypedExpr * ) = 0;
Note:
See TracChangeset
for help on using the changeset viewer.