Ignore:
File:
1 edited

Legend:

Unmodified
Added
Removed
  • src/AST/Convert.cpp

    r665f432 r37cdd97  
    1010// Created On       : Thu May 09 15::37::05 2019
    1111// Last Modified By : Peter A. Buhr
    12 // Last Modified On : Thu Jul 25 22:21:46 2019
    13 // Update Count     : 13
     12// Last Modified On : Wed Dec 11 21:39:32 2019
     13// Update Count     : 33
    1414//
    1515
     
    245245                auto decl = new StructDecl(
    246246                        node->name,
    247                         node->kind,
     247                        (AggregateDecl::Aggregate)node->kind,
    248248                        get<Attribute>().acceptL( node->attributes ),
    249249                        LinkageSpec::Spec( node->linkage.val )
     
    493493        }
    494494
     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
    495507        const ast::Stmt * visit( const ast::WaitForStmt * node ) override final {
    496508                if ( inCache( node ) ) return nullptr;
     
    675687
    676688        const ast::Expr * visit( const ast::KeywordCastExpr * node ) override final {
    677                 KeywordCastExpr::Target castTarget = KeywordCastExpr::NUMBER_OF_TARGETS;
    678                 switch (node->target) {
    679                         case ast::KeywordCastExpr::Coroutine:
    680                                 castTarget = KeywordCastExpr::Coroutine;
    681                                 break;
    682                         case ast::KeywordCastExpr::Thread:
    683                                 castTarget = KeywordCastExpr::Thread;
    684                                 break;
    685                         case ast::KeywordCastExpr::Monitor:
    686                                 castTarget = KeywordCastExpr::Monitor;
    687                                 break;
    688                         default:
    689                                 break;
    690                 }
    691                 assert ( castTarget < KeywordCastExpr::NUMBER_OF_TARGETS );
     689                AggregateDecl::Aggregate castTarget = (AggregateDecl::Aggregate)node->target;
     690                assert( AggregateDecl::Generator <= castTarget && castTarget <= AggregateDecl::Thread );
    692691                auto expr = visitBaseExpr( node,
    693692                        new KeywordCastExpr(
     
    12361235                                cv( node ),
    12371236                                node->name,
    1238                                 node->kind == ast::TypeVar::Ftype,
     1237                                node->kind == ast::TypeDecl::Ftype,
    12391238                                get<Attribute>().acceptL( node->attributes )
    12401239                        };
     
    15041503                        old->location,
    15051504                        old->name,
    1506                         old->kind,
     1505                        (ast::AggregateDecl::Aggregate)old->kind,
    15071506                        GET_ACCEPT_V(attributes, Attribute),
    15081507                        { old->linkage.val }
     
    15911590                        { old->storageClasses.val },
    15921591                        GET_ACCEPT_1(base, Type),
    1593                         (ast::TypeVar::Kind)(unsigned)old->kind,
     1592                        (ast::TypeDecl::Kind)(unsigned)old->kind,
    15941593                        old->sized,
    15951594                        GET_ACCEPT_1(init, Type)
     
    18721871        }
    18731872
     1873        virtual void visit( const SuspendStmt * old ) override final {
     1874                if ( inCache( old ) ) return;
     1875                ast::SuspendStmt::Type type;
     1876                switch (old->type) {
     1877                        case SuspendStmt::Coroutine: type = ast::SuspendStmt::Coroutine; break;
     1878                        case SuspendStmt::Generator: type = ast::SuspendStmt::Generator; break;
     1879                        case SuspendStmt::None     : type = ast::SuspendStmt::None     ; break;
     1880                        default: abort();
     1881                }
     1882                this->node = new ast::SuspendStmt(
     1883                        old->location,
     1884                        GET_ACCEPT_1(then  , CompoundStmt),
     1885                        type,
     1886                        GET_LABELS_V(old->labels)
     1887                );
     1888                cache.emplace( old, this->node );
     1889        }
     1890
    18741891        virtual void visit( const WaitForStmt * old ) override final {
    18751892                if ( inCache( old ) ) return;
     
    20452062        }
    20462063
    2047         virtual void visit( const KeywordCastExpr * old) override final {
    2048                 ast::KeywordCastExpr::Target castTarget = ast::KeywordCastExpr::NUMBER_OF_TARGETS;
    2049                 switch (old->target) {
    2050                         case KeywordCastExpr::Coroutine:
    2051                                 castTarget = ast::KeywordCastExpr::Coroutine;
    2052                                 break;
    2053                         case KeywordCastExpr::Thread:
    2054                                 castTarget = ast::KeywordCastExpr::Thread;
    2055                                 break;
    2056                         case KeywordCastExpr::Monitor:
    2057                                 castTarget = ast::KeywordCastExpr::Monitor;
    2058                                 break;
    2059                         default:
    2060                                 break;
    2061                 }
    2062                 assert ( castTarget < ast::KeywordCastExpr::NUMBER_OF_TARGETS );
     2064        virtual void visit( const KeywordCastExpr * old ) override final {
     2065                ast::AggregateDecl::Aggregate castTarget = (ast::AggregateDecl::Aggregate)old->target;
     2066                assert( ast::AggregateDecl::Generator <= castTarget && castTarget <= ast::AggregateDecl::Thread );
    20632067                this->node = visitBaseExpr( old,
    20642068                        new ast::KeywordCastExpr(
     
    25872591                        ty = new ast::TypeInstType{
    25882592                                old->name,
    2589                                 old->isFtype ? ast::TypeVar::Ftype : ast::TypeVar::Dtype,
     2593                                old->isFtype ? ast::TypeDecl::Ftype : ast::TypeDecl::Dtype,
    25902594                                cv( old ),
    25912595                                GET_ACCEPT_V( attributes, Attribute )
Note: See TracChangeset for help on using the changeset viewer.