Changeset 7030dab for src/AST/Convert.cpp
- Timestamp:
- Apr 6, 2020, 4:46:28 PM (4 years ago)
- Branches:
- ADT, arm-eh, ast-experimental, enum, forall-pointer-decay, jacob/cs343-translation, master, new-ast, new-ast-unique-expr, pthread-emulation, qualifiedEnum
- Children:
- e3bc51c
- Parents:
- 71d6bd8 (diff), 057298e (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. - File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
src/AST/Convert.cpp
r71d6bd8 r7030dab 10 10 // Created On : Thu May 09 15::37::05 2019 11 11 // Last Modified By : Peter A. Buhr 12 // Last Modified On : Thu Jul 25 22:21:46201913 // Update Count : 1312 // Last Modified On : Wed Dec 11 21:39:32 2019 13 // Update Count : 33 14 14 // 15 15 … … 245 245 auto decl = new StructDecl( 246 246 node->name, 247 node->kind,247 (AggregateDecl::Aggregate)node->kind, 248 248 get<Attribute>().acceptL( node->attributes ), 249 249 LinkageSpec::Spec( node->linkage.val ) … … 493 493 } 494 494 495 const ast::Stmt * visit(const ast::SuspendStmt * node ) override final { 496 if ( inCache( node ) ) return nullptr; 497 auto stmt = new SuspendStmt(); 498 stmt->then = get<CompoundStmt>().accept1( node->then ); 499 switch(node->type) { 500 case ast::SuspendStmt::None : stmt->type = SuspendStmt::None ; break; 501 case ast::SuspendStmt::Coroutine: stmt->type = SuspendStmt::Coroutine; break; 502 case ast::SuspendStmt::Generator: stmt->type = SuspendStmt::Generator; break; 503 } 504 return stmtPostamble( stmt, node ); 505 } 506 495 507 const ast::Stmt * visit( const ast::WaitForStmt * node ) override final { 496 508 if ( inCache( node ) ) return nullptr; … … 686 698 687 699 const ast::Expr * visit( const ast::KeywordCastExpr * node ) override final { 688 KeywordCastExpr::Target castTarget = KeywordCastExpr::NUMBER_OF_TARGETS; 689 switch (node->target) { 690 case ast::KeywordCastExpr::Coroutine: 691 castTarget = KeywordCastExpr::Coroutine; 692 break; 693 case ast::KeywordCastExpr::Thread: 694 castTarget = KeywordCastExpr::Thread; 695 break; 696 case ast::KeywordCastExpr::Monitor: 697 castTarget = KeywordCastExpr::Monitor; 698 break; 699 default: 700 break; 701 } 702 assert ( castTarget < KeywordCastExpr::NUMBER_OF_TARGETS ); 700 AggregateDecl::Aggregate castTarget = (AggregateDecl::Aggregate)node->target; 701 assert( AggregateDecl::Generator <= castTarget && castTarget <= AggregateDecl::Thread ); 703 702 auto expr = visitBaseExpr( node, 704 703 new KeywordCastExpr( … … 1247 1246 cv( node ), 1248 1247 node->name, 1249 node->kind == ast::Type Var::Ftype,1248 node->kind == ast::TypeDecl::Ftype, 1250 1249 get<Attribute>().acceptL( node->attributes ) 1251 1250 }; … … 1515 1514 old->location, 1516 1515 old->name, 1517 old->kind,1516 (ast::AggregateDecl::Aggregate)old->kind, 1518 1517 GET_ACCEPT_V(attributes, Attribute), 1519 1518 { old->linkage.val } … … 1602 1601 { old->storageClasses.val }, 1603 1602 GET_ACCEPT_1(base, Type), 1604 (ast::Type Var::Kind)(unsigned)old->kind,1603 (ast::TypeDecl::Kind)(unsigned)old->kind, 1605 1604 old->sized, 1606 1605 GET_ACCEPT_1(init, Type) … … 1883 1882 } 1884 1883 1884 virtual void visit( const SuspendStmt * old ) override final { 1885 if ( inCache( old ) ) return; 1886 ast::SuspendStmt::Type type; 1887 switch (old->type) { 1888 case SuspendStmt::Coroutine: type = ast::SuspendStmt::Coroutine; break; 1889 case SuspendStmt::Generator: type = ast::SuspendStmt::Generator; break; 1890 case SuspendStmt::None : type = ast::SuspendStmt::None ; break; 1891 default: abort(); 1892 } 1893 this->node = new ast::SuspendStmt( 1894 old->location, 1895 GET_ACCEPT_1(then , CompoundStmt), 1896 type, 1897 GET_LABELS_V(old->labels) 1898 ); 1899 cache.emplace( old, this->node ); 1900 } 1901 1885 1902 virtual void visit( const WaitForStmt * old ) override final { 1886 1903 if ( inCache( old ) ) return; … … 2056 2073 } 2057 2074 2058 virtual void visit( const KeywordCastExpr * old) override final { 2059 ast::KeywordCastExpr::Target castTarget = ast::KeywordCastExpr::NUMBER_OF_TARGETS; 2060 switch (old->target) { 2061 case KeywordCastExpr::Coroutine: 2062 castTarget = ast::KeywordCastExpr::Coroutine; 2063 break; 2064 case KeywordCastExpr::Thread: 2065 castTarget = ast::KeywordCastExpr::Thread; 2066 break; 2067 case KeywordCastExpr::Monitor: 2068 castTarget = ast::KeywordCastExpr::Monitor; 2069 break; 2070 default: 2071 break; 2072 } 2073 assert ( castTarget < ast::KeywordCastExpr::NUMBER_OF_TARGETS ); 2075 virtual void visit( const KeywordCastExpr * old ) override final { 2076 ast::AggregateDecl::Aggregate castTarget = (ast::AggregateDecl::Aggregate)old->target; 2077 assert( ast::AggregateDecl::Generator <= castTarget && castTarget <= ast::AggregateDecl::Thread ); 2074 2078 this->node = visitBaseExpr( old, 2075 2079 new ast::KeywordCastExpr( … … 2599 2603 ty = new ast::TypeInstType{ 2600 2604 old->name, 2601 old->isFtype ? ast::Type Var::Ftype : ast::TypeVar::Dtype,2605 old->isFtype ? ast::TypeDecl::Ftype : ast::TypeDecl::Dtype, 2602 2606 cv( old ), 2603 2607 GET_ACCEPT_V( attributes, Attribute )
Note: See TracChangeset
for help on using the changeset viewer.