- Timestamp:
- Nov 6, 2023, 2:19:37 PM (14 months ago)
- Branches:
- master
- Children:
- ba0e1bc
- Parents:
- 49ae2bc
- Location:
- src/AST
- Files:
-
- 8 edited
Legend:
- Unmodified
- Added
- Removed
-
src/AST/Convert.cpp
r49ae2bc r3d9d017 656 656 } 657 657 658 const ast::Stmt * visit( const ast::CoforStmt * node ) override final { 659 // There is no old-AST CoforStmt, so this should never be called. 660 assert( !node ); 661 return nullptr; 662 } 663 658 664 TypeSubstitution * convertTypeSubstitution(const ast::TypeSubstitution * src) { 659 665 -
src/AST/Fwd.hpp
r49ae2bc r3d9d017 68 68 class MutexStmt; 69 69 class CorunStmt; 70 class CoforStmt; 70 71 71 72 class Expr; -
src/AST/Node.cpp
r49ae2bc r3d9d017 194 194 template class ast::ptr_base< ast::CorunStmt, ast::Node::ref_type::weak >; 195 195 template class ast::ptr_base< ast::CorunStmt, ast::Node::ref_type::strong >; 196 template class ast::ptr_base< ast::CoforStmt, ast::Node::ref_type::weak >; 197 template class ast::ptr_base< ast::CoforStmt, ast::Node::ref_type::strong >; 196 198 template class ast::ptr_base< ast::Expr, ast::Node::ref_type::weak >; 197 199 template class ast::ptr_base< ast::Expr, ast::Node::ref_type::strong >; -
src/AST/Pass.hpp
r49ae2bc r3d9d017 172 172 const ast::Stmt * visit( const ast::MutexStmt * ) override final; 173 173 const ast::Stmt * visit( const ast::CorunStmt * ) override final; 174 const ast::Stmt * visit( const ast::CoforStmt * ) override final; 174 175 const ast::Expr * visit( const ast::ApplicationExpr * ) override final; 175 176 const ast::Expr * visit( const ast::UntypedExpr * ) override final; -
src/AST/Pass.impl.hpp
r49ae2bc r3d9d017 1134 1134 1135 1135 //-------------------------------------------------------------------------- 1136 // CoforStmt 1137 template< typename core_t > 1138 const ast::Stmt * ast::Pass< core_t >::visit( const ast::CoforStmt * node ) { 1139 VISIT_START( node ); 1140 1141 if ( __visit_children() ) { 1142 // for statements introduce a level of scope (for the initialization) 1143 guard_symtab guard { *this }; 1144 maybe_accept( node, &CoforStmt::inits ); 1145 maybe_accept_top( node, &CoforStmt::cond ); 1146 maybe_accept_top( node, &CoforStmt::inc ); 1147 maybe_accept_as_compound( node, &CoforStmt::body ); 1148 } 1149 1150 VISIT_END( Stmt, node ); 1151 } 1152 1153 //-------------------------------------------------------------------------- 1136 1154 // ApplicationExpr 1137 1155 template< typename core_t > -
src/AST/Print.cpp
r49ae2bc r3d9d017 934 934 } 935 935 936 virtual const ast::Stmt * visit( const ast::CoforStmt * node ) override final { 937 os << "Cofor Statement" << endl; 938 939 if ( ! node->inits.empty() ) { 940 os << indent << "... initialization:" << endl; 941 ++indent; 942 for ( const ast::Stmt * stmt : node->inits ) { 943 os << indent+1; 944 safe_print( stmt ); 945 } 946 --indent; 947 } 948 949 if ( node->cond ) { 950 os << indent << "... condition:" << endl; 951 ++indent; 952 os << indent; 953 node->cond->accept( *this ); 954 --indent; 955 } 956 957 if ( node->inc ) { 958 os << indent << "... increment:" << endl; 959 ++indent; 960 os << indent; 961 node->inc->accept( *this ); 962 --indent; 963 } 964 965 if ( node->body ) { 966 os << indent << "... with body:" << endl; 967 ++indent; 968 os << indent; 969 node->body->accept( *this ); 970 --indent; 971 } 972 os << endl; 973 print( node->labels ); 974 975 return node; 976 } 977 936 978 virtual const ast::Expr * visit( const ast::ApplicationExpr * node ) override final { 937 979 ++indent; -
src/AST/Stmt.hpp
r49ae2bc r3d9d017 546 546 }; 547 547 548 // Corun Statement 549 class CoforStmt final : public Stmt { 550 public: 551 std::vector<ptr<Stmt>> inits; 552 ptr<Expr> cond; 553 ptr<Expr> inc; 554 ptr<Stmt> body; 555 556 CoforStmt( const CodeLocation & loc, const std::vector<ptr<Stmt>> && inits, const Expr * cond, 557 const Expr * inc, const Stmt * body, const std::vector<Label> && label = {} ) 558 : Stmt(loc, std::move(label)), inits(std::move(inits)), cond(cond), inc(inc), body(body) {} 559 560 const Stmt * accept( Visitor & v ) const override { return v.visit( this ); } 561 private: 562 CoforStmt * clone() const override { return new CoforStmt{ *this }; } 563 MUTATE_FRIEND 564 }; 565 548 566 } // namespace ast 549 567 -
src/AST/Visitor.hpp
r49ae2bc r3d9d017 60 60 virtual const ast::Stmt * visit( const ast::MutexStmt * ) = 0; 61 61 virtual const ast::Stmt * visit( const ast::CorunStmt * ) = 0; 62 virtual const ast::Stmt * visit( const ast::CoforStmt * ) = 0; 62 63 virtual const ast::Expr * visit( const ast::ApplicationExpr * ) = 0; 63 64 virtual const ast::Expr * visit( const ast::UntypedExpr * ) = 0;
Note: See TracChangeset
for help on using the changeset viewer.