Ignore:
Timestamp:
Apr 6, 2020, 4:46:28 PM (4 years ago)
Author:
Thierry Delisle <tdelisle@…>
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.
Message:

Merge branch 'master' into new-ast

File:
1 edited

Legend:

Unmodified
Added
Removed
  • src/AST/Convert.cpp

    r71d6bd8 r7030dab  
    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;
     
    686698
    687699        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 );
    703702                auto expr = visitBaseExpr( node,
    704703                        new KeywordCastExpr(
     
    12471246                                cv( node ),
    12481247                                node->name,
    1249                                 node->kind == ast::TypeVar::Ftype,
     1248                                node->kind == ast::TypeDecl::Ftype,
    12501249                                get<Attribute>().acceptL( node->attributes )
    12511250                        };
     
    15151514                        old->location,
    15161515                        old->name,
    1517                         old->kind,
     1516                        (ast::AggregateDecl::Aggregate)old->kind,
    15181517                        GET_ACCEPT_V(attributes, Attribute),
    15191518                        { old->linkage.val }
     
    16021601                        { old->storageClasses.val },
    16031602                        GET_ACCEPT_1(base, Type),
    1604                         (ast::TypeVar::Kind)(unsigned)old->kind,
     1603                        (ast::TypeDecl::Kind)(unsigned)old->kind,
    16051604                        old->sized,
    16061605                        GET_ACCEPT_1(init, Type)
     
    18831882        }
    18841883
     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
    18851902        virtual void visit( const WaitForStmt * old ) override final {
    18861903                if ( inCache( old ) ) return;
     
    20562073        }
    20572074
    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 );
    20742078                this->node = visitBaseExpr( old,
    20752079                        new ast::KeywordCastExpr(
     
    25992603                        ty = new ast::TypeInstType{
    26002604                                old->name,
    2601                                 old->isFtype ? ast::TypeVar::Ftype : ast::TypeVar::Dtype,
     2605                                old->isFtype ? ast::TypeDecl::Ftype : ast::TypeDecl::Dtype,
    26022606                                cv( old ),
    26032607                                GET_ACCEPT_V( attributes, Attribute )
Note: See TracChangeset for help on using the changeset viewer.