Ignore:
File:
1 edited

Legend:

Unmodified
Added
Removed
  • src/AST/Convert.cpp

    rc86b08d r561354f  
    283283                decl->parent = get<AggregateDecl>().accept1( node->parent );
    284284                declPostamble( decl, node );
    285                 return nullptr; // ??
     285                return nullptr;
    286286        }
    287287
     
    320320                        LinkageSpec::Spec( node->linkage.val ),
    321321                        get<Type>().accept1(node->base)
     322                );
     323                // decl->data_constructors = get<StructDecl>().acceptL( node->data_constructors );
     324                // decl->data_union = get<UnionDecl>().accept1( node->data_union );
     325                // decl->tag = get<EnumDecl>().accept1( node->tag );
     326                // decl->tag_union = get<StructDecl>().accept1( node->tag_union );
     327                return aggregatePostamble( decl, node );
     328        }
     329
     330        const ast::Decl * visit( const ast::AdtDecl * node ) override final {
     331                if ( inCache(node) ) return nullptr;
     332                auto decl = new AdtDecl(
     333                        node->name,
     334                        get<Attribute>().acceptL( node->attributes ),
     335                        LinkageSpec::Spec( node->linkage.val ),
     336                        get<StructDecl>().acceptL( node->data_constructors ),
     337                        get<UnionDecl>().accept1( node->data_union ),
     338                        get<EnumDecl>().accept1( node->tag ),
     339                        get<StructDecl>().accept1( node->tag_union )
    322340                );
    323341                return aggregatePostamble( decl, node );
     
    559577                auto stmt = new SuspendStmt();
    560578                stmt->then   = get<CompoundStmt>().accept1( node->then   );
    561                 switch(node->type) {
     579                switch (node->kind) {
    562580                        case ast::SuspendStmt::None     : stmt->type = SuspendStmt::None     ; break;
    563581                        case ast::SuspendStmt::Coroutine: stmt->type = SuspendStmt::Coroutine; break;
     
    565583                }
    566584                return stmtPostamble( stmt, node );
    567         }
    568 
    569     const ast::WhenClause * visit( const ast::WhenClause * node ) override final {
    570                 // There is no old-AST WhenClause, so this should never be called.
    571                 assert( !node );
    572                 return nullptr;
    573585        }
    574586
     
    579591                for ( auto clause : node->clauses ) {
    580592                        stmt->clauses.push_back({{
    581                                         get<Expression>().accept1( clause->target ),
     593                                        get<Expression>().accept1( clause->target_func ),
    582594                                        get<Expression>().acceptL( clause->target_args ),
    583595                                },
    584596                                get<Statement>().accept1( clause->stmt ),
    585                                 get<Expression>().accept1( clause->when_cond ),
     597                                get<Expression>().accept1( clause->cond ),
    586598                        });
    587599                }
     
    600612        const ast::WaitForClause * visit( const ast::WaitForClause * node ) override final {
    601613                // There is no old-AST WaitForClause, so this should never be called.
    602                 assert( !node );
    603                 return nullptr;
    604         }
    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.
    608614                assert( !node );
    609615                return nullptr;
     
    16951701                        GET_ACCEPT_V(attributes, Attribute),
    16961702                        { old->get_funcSpec().val },
    1697                         old->type->isVarArgs
     1703                        (old->type->isVarArgs) ? ast::VariableArgs : ast::FixedArgs
    16981704                };
    16991705
     
    17871793                decl->uniqueId   = old->uniqueId;
    17881794                decl->storage    = { old->storageClasses.val };
     1795                this->node = decl;
     1796        }
     1797
     1798        virtual void visit( const AdtDecl * old ) override final {
     1799                if ( inCache( old ) ) return;
     1800                auto decl = new ast::AdtDecl(
     1801                        old->location,
     1802                        old->name,
     1803                        GET_ACCEPT_V(attributes, Attribute),
     1804                        { old->linkage.val }
     1805                );
     1806                cache.emplace( old, decl );
     1807                decl->parent = GET_ACCEPT_1(parent, AggregateDecl);
     1808                decl->body = old->body;
     1809                decl->params = GET_ACCEPT_V(parameters, TypeDecl);
     1810                decl->members = GET_ACCEPT_V(members, Decl);
     1811                decl->extension = old->extension;
     1812                decl->uniqueId = old->uniqueId;
     1813                decl->storage = { old->storageClasses.val };
     1814                decl->data_constructors = GET_ACCEPT_V( data_constructors, StructDecl );
     1815                decl->data_union = GET_ACCEPT_1( data_union, UnionDecl );
     1816                decl->tag = GET_ACCEPT_1( tag, EnumDecl );
     1817                decl->tag_union = GET_ACCEPT_1( tag_union, StructDecl );
    17891818                this->node = decl;
    17901819        }
     
    20012030                        GET_ACCEPT_1(else_, Stmt),
    20022031                        GET_ACCEPT_V(initialization, Stmt),
    2003                         old->isDoWhile,
     2032                        (old->isDoWhile) ? ast::DoWhile : ast::While,
    20042033                        GET_LABELS_V(old->labels)
    20052034                );
     
    21432172        virtual void visit( const SuspendStmt * old ) override final {
    21442173                if ( inCache( old ) ) return;
    2145                 ast::SuspendStmt::Type type;
     2174                ast::SuspendStmt::Kind type;
    21462175                switch (old->type) {
    21472176                        case SuspendStmt::Coroutine: type = ast::SuspendStmt::Coroutine; break;
     
    21702199                        auto clause = new ast::WaitForClause( old->location );
    21712200
    2172                         clause->target = GET_ACCEPT_1(clauses[i].target.function, Expr);
     2201                        clause->target_func = GET_ACCEPT_1(clauses[i].target.function, Expr);
    21732202                        clause->target_args = GET_ACCEPT_V(clauses[i].target.arguments, Expr);
    21742203                        clause->stmt = GET_ACCEPT_1(clauses[i].statement, Stmt);
    2175                         clause->when_cond = GET_ACCEPT_1(clauses[i].condition, Expr);
     2204                        clause->cond = GET_ACCEPT_1(clauses[i].condition, Expr);
    21762205
    21772206                        stmt->clauses.push_back( clause );
Note: See TracChangeset for help on using the changeset viewer.