Changeset e04b636 for src/Concurrency


Ignore:
Timestamp:
Mar 21, 2017, 12:36:01 PM (7 years ago)
Author:
Thierry Delisle <tdelisle@…>
Branches:
ADT, aaron-thesis, arm-eh, ast-experimental, cleanup-dtors, deferred_resn, demangler, enum, forall-pointer-decay, jacob/cs343-translation, jenkins-sandbox, master, new-ast, new-ast-unique-expr, new-env, no_list, persistent-indexer, pthread-emulation, qualifiedEnum, resolv-new, with_gc
Children:
168c007, cb0e6de
Parents:
31ce3d6
Message:

Implemented and tested coroutine keyword

File:
1 edited

Legend:

Unmodified
Added
Removed
  • src/Concurrency/Keywords.cc

    r31ce3d6 re04b636  
    150150                        coroutine_decl = decl;
    151151                }
    152                 else if ( false ) {
     152                else if ( decl->is_coroutine() ) {
    153153                        handle( decl );
    154154                }
     
    178178                );
    179179
    180                 decl->get_members().push_front( cor );
     180                decl->get_members().push_back( cor );
    181181
    182182                return cor;
     
    201201                        )
    202202                );
     203                type->get_returnVals().push_back(
     204                        new ObjectDecl(
     205                                "ret",
     206                                noStorage,
     207                                LinkageSpec::Cforall,
     208                                nullptr,
     209                                new PointerType(
     210                                        noQualifiers,
     211                                        new StructInstType(
     212                                                noQualifiers,
     213                                                coroutine_decl
     214                                        )
     215                                ),
     216                                nullptr
     217                        )
     218                );
    203219
    204220                CompoundStmt * statement = new CompoundStmt( noLabels );
     
    206222                        new ReturnStmt(
    207223                                noLabels,
    208                                 new UntypedMemberExpr(
    209                                         new NameExpr( "__cor" ),
    210                                         new NameExpr( "this" )
     224                                new AddressExpr(
     225                                        new UntypedMemberExpr(
     226                                                new NameExpr( "__cor" ),
     227                                                new UntypedExpr(
     228                                                        new NameExpr( "*?" ),
     229                                                        { new NameExpr( "this" ) }
     230                                                )
     231                                        )
    211232                                )
    212233                        )
    213234                );
    214235
    215                 declsToAddAfter.push_back(
    216                         new FunctionDecl(
    217                                 "get_coroutine",
    218                                 Type::Static,
    219                                 LinkageSpec::Cforall,
    220                                 type,
    221                                 statement,
    222                                 noAttributes,
    223                                 Type::Inline
    224                         )
    225                 );
     236                FunctionDecl * get_decl = new FunctionDecl(
     237                        "get_coroutine",
     238                        Type::Static,
     239                        LinkageSpec::Cforall,
     240                        type,
     241                        statement,
     242                        noAttributes,
     243                        Type::Inline
     244                );
     245
     246                declsToAddAfter.push_back( get_decl );
     247
     248                get_decl->fixUniqueId();
    226249        }
    227250       
     
    285308
    286309                //Make sure that typed isn't mutex
    287                 if( ! base->get_mutex() ) throw SemanticError( "mutex keyword may only appear once per argument ", arg );
     310                if( base->get_mutex() ) throw SemanticError( "mutex keyword may only appear once per argument ", arg );
    288311        }
    289312
Note: See TracChangeset for help on using the changeset viewer.