Changeset 1cb758f2 for src/SynTree


Ignore:
Timestamp:
Aug 27, 2017, 11:26:26 AM (7 years ago)
Author:
Rob Schluntz <rschlunt@…>
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:
111a8af8, 26238c1, 7ee1e2f6
Parents:
0c6596f (diff), eca3d10 (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' of plg.uwaterloo.ca:/u/cforall/software/cfa/cfa-cc

Location:
src/SynTree
Files:
7 edited

Legend:

Unmodified
Added
Removed
  • src/SynTree/Mutator.cc

    r0c6596f r1cb758f2  
    3232Mutator::~Mutator() {}
    3333
    34 DeclarationWithType *Mutator::mutate( ObjectDecl *objectDecl ) {
     34DeclarationWithType * Mutator::mutate( ObjectDecl *objectDecl ) {
    3535        objectDecl->set_type( maybeMutate( objectDecl->get_type(), *this ) );
    3636        objectDecl->set_init( maybeMutate( objectDecl->get_init(), *this ) );
     
    3939}
    4040
    41 DeclarationWithType *Mutator::mutate( FunctionDecl *functionDecl ) {
     41DeclarationWithType * Mutator::mutate( FunctionDecl *functionDecl ) {
    4242        functionDecl->set_functionType( maybeMutate( functionDecl->get_functionType(), *this ) );
    4343        functionDecl->set_statements( maybeMutate( functionDecl->get_statements(), *this ) );
     
    4545}
    4646
    47 Declaration *Mutator::handleAggregateDecl( AggregateDecl *aggregateDecl ) {
     47Declaration * Mutator::handleAggregateDecl( AggregateDecl *aggregateDecl ) {
    4848        mutateAll( aggregateDecl->get_parameters(), *this );
    4949        mutateAll( aggregateDecl->get_members(), *this );
     
    5151}
    5252
    53 Declaration *Mutator::mutate( StructDecl *aggregateDecl ) {
     53Declaration * Mutator::mutate( StructDecl *aggregateDecl ) {
    5454        handleAggregateDecl( aggregateDecl );
    5555        return aggregateDecl;
    5656}
    5757
    58 Declaration *Mutator::mutate( UnionDecl *aggregateDecl ) {
     58Declaration * Mutator::mutate( UnionDecl *aggregateDecl ) {
    5959        handleAggregateDecl( aggregateDecl );
    6060        return aggregateDecl;
    6161}
    6262
    63 Declaration *Mutator::mutate( EnumDecl *aggregateDecl ) {
     63Declaration * Mutator::mutate( EnumDecl *aggregateDecl ) {
    6464        handleAggregateDecl( aggregateDecl );
    6565        return aggregateDecl;
    6666}
    6767
    68 Declaration *Mutator::mutate( TraitDecl *aggregateDecl ) {
     68Declaration * Mutator::mutate( TraitDecl *aggregateDecl ) {
    6969        handleAggregateDecl( aggregateDecl );
    7070        return aggregateDecl;
    7171}
    7272
    73 Declaration *Mutator::handleNamedTypeDecl( NamedTypeDecl *typeDecl ) {
     73Declaration * Mutator::handleNamedTypeDecl( NamedTypeDecl *typeDecl ) {
    7474        mutateAll( typeDecl->get_parameters(), *this );
    7575        mutateAll( typeDecl->get_assertions(), *this );
     
    7878}
    7979
    80 TypeDecl *Mutator::mutate( TypeDecl *typeDecl ) {
     80TypeDecl * Mutator::mutate( TypeDecl *typeDecl ) {
    8181        handleNamedTypeDecl( typeDecl );
    8282        typeDecl->set_init( maybeMutate( typeDecl->get_init(), *this ) );
     
    8484}
    8585
    86 Declaration *Mutator::mutate( TypedefDecl *typeDecl ) {
     86Declaration * Mutator::mutate( TypedefDecl *typeDecl ) {
    8787        handleNamedTypeDecl( typeDecl );
    8888        return typeDecl;
    8989}
    9090
    91 AsmDecl *Mutator::mutate( AsmDecl *asmDecl ) {
     91AsmDecl * Mutator::mutate( AsmDecl *asmDecl ) {
    9292        asmDecl->set_stmt( maybeMutate( asmDecl->get_stmt(), *this ) );
    9393        return asmDecl;
     
    9595
    9696
    97 CompoundStmt *Mutator::mutate( CompoundStmt *compoundStmt ) {
     97CompoundStmt * Mutator::mutate( CompoundStmt *compoundStmt ) {
    9898        mutateAll( compoundStmt->get_kids(), *this );
    9999        return compoundStmt;
    100100}
    101101
    102 Statement *Mutator::mutate( ExprStmt *exprStmt ) {
     102Statement * Mutator::mutate( ExprStmt *exprStmt ) {
    103103        exprStmt->set_expr( maybeMutate( exprStmt->get_expr(), *this ) );
    104104        return exprStmt;
    105105}
    106106
    107 Statement *Mutator::mutate( AsmStmt *asmStmt ) {
     107Statement * Mutator::mutate( AsmStmt *asmStmt ) {
    108108        asmStmt->set_instruction( maybeMutate( asmStmt->get_instruction(), *this ) );
    109109        mutateAll( asmStmt->get_output(), *this );
     
    113113}
    114114
    115 Statement *Mutator::mutate( IfStmt *ifStmt ) {
     115Statement * Mutator::mutate( IfStmt *ifStmt ) {
    116116        mutateAll( ifStmt->get_initialization(), *this );
    117117        ifStmt->set_condition( maybeMutate( ifStmt->get_condition(), *this ) );
     
    121121}
    122122
    123 Statement *Mutator::mutate( WhileStmt *whileStmt ) {
     123Statement * Mutator::mutate( WhileStmt *whileStmt ) {
    124124        whileStmt->set_condition( maybeMutate( whileStmt->get_condition(), *this ) );
    125125        whileStmt->set_body( maybeMutate( whileStmt->get_body(), *this ) );
     
    127127}
    128128
    129 Statement *Mutator::mutate( ForStmt *forStmt ) {
     129Statement * Mutator::mutate( ForStmt *forStmt ) {
    130130        mutateAll( forStmt->get_initialization(), *this );
    131131        forStmt->set_condition( maybeMutate( forStmt->get_condition(), *this ) );
     
    135135}
    136136
    137 Statement *Mutator::mutate( SwitchStmt *switchStmt ) {
     137Statement * Mutator::mutate( SwitchStmt *switchStmt ) {
    138138        switchStmt->set_condition( maybeMutate( switchStmt->get_condition(), *this ) );
    139139        mutateAll( switchStmt->get_statements(), *this );
     
    141141}
    142142
    143 Statement *Mutator::mutate( CaseStmt *caseStmt ) {
     143Statement * Mutator::mutate( CaseStmt *caseStmt ) {
    144144        caseStmt->set_condition( maybeMutate( caseStmt->get_condition(), *this ) );
    145145        mutateAll (caseStmt->get_statements(), *this );
     
    148148}
    149149
    150 Statement *Mutator::mutate( BranchStmt *branchStmt ) {
     150Statement * Mutator::mutate( BranchStmt *branchStmt ) {
    151151        return branchStmt;
    152152}
    153153
    154 Statement *Mutator::mutate( ReturnStmt *returnStmt ) {
     154Statement * Mutator::mutate( ReturnStmt *returnStmt ) {
    155155        returnStmt->set_expr( maybeMutate( returnStmt->get_expr(), *this ) );
    156156        return returnStmt;
    157157}
    158158
    159 Statement *Mutator::mutate( ThrowStmt *throwStmt ) {
     159Statement * Mutator::mutate( ThrowStmt *throwStmt ) {
    160160        throwStmt->set_expr( maybeMutate( throwStmt->get_expr(), *this ) );
    161161        throwStmt->set_target( maybeMutate( throwStmt->get_target(), *this ) );
     
    163163}
    164164
    165 Statement *Mutator::mutate( TryStmt *tryStmt ) {
     165Statement * Mutator::mutate( TryStmt *tryStmt ) {
    166166        tryStmt->set_block( maybeMutate( tryStmt->get_block(), *this ) );
    167167        mutateAll( tryStmt->get_catchers(), *this );
     
    170170}
    171171
    172 Statement *Mutator::mutate( CatchStmt *catchStmt ) {
     172Statement * Mutator::mutate( CatchStmt *catchStmt ) {
    173173        catchStmt->set_decl( maybeMutate( catchStmt->get_decl(), *this ) );
    174174        catchStmt->set_cond( maybeMutate( catchStmt->get_cond(), *this ) );
     
    177177}
    178178
    179 Statement *Mutator::mutate( FinallyStmt *finalStmt ) {
     179Statement * Mutator::mutate( FinallyStmt *finalStmt ) {
    180180        finalStmt->set_block( maybeMutate( finalStmt->get_block(), *this ) );
    181181        return finalStmt;
    182182}
    183183
    184 NullStmt *Mutator::mutate( NullStmt *nullStmt ) {
     184Statement * Mutator::mutate( WaitForStmt *waitforStmt ) {
     185        for( auto & clause : waitforStmt->clauses ) {
     186                clause.target.function = maybeMutate( clause.target.function, *this );
     187                mutateAll( clause.target.arguments, *this );
     188
     189                clause.statement = maybeMutate( clause.statement, *this );
     190                clause.condition = maybeMutate( clause.condition, *this );
     191        }
     192
     193        waitforStmt->timeout.time      = maybeMutate( waitforStmt->timeout.time, *this );
     194        waitforStmt->timeout.statement = maybeMutate( waitforStmt->timeout.statement, *this );
     195        waitforStmt->timeout.condition = maybeMutate( waitforStmt->timeout.condition, *this );
     196        waitforStmt->orelse.statement  = maybeMutate( waitforStmt->orelse.statement, *this );
     197        waitforStmt->orelse.condition  = maybeMutate( waitforStmt->orelse.condition, *this );
     198
     199        return waitforStmt;
     200}
     201
     202NullStmt * Mutator::mutate( NullStmt *nullStmt ) {
    185203        return nullStmt;
    186204}
    187205
    188 Statement *Mutator::mutate( DeclStmt *declStmt ) {
     206Statement * Mutator::mutate( DeclStmt *declStmt ) {
    189207        declStmt->set_decl( maybeMutate( declStmt->get_decl(), *this ) );
    190208        return declStmt;
    191209}
    192210
    193 Statement *Mutator::mutate( ImplicitCtorDtorStmt *impCtorDtorStmt ) {
     211Statement * Mutator::mutate( ImplicitCtorDtorStmt *impCtorDtorStmt ) {
    194212        impCtorDtorStmt->set_callStmt( maybeMutate( impCtorDtorStmt->get_callStmt(), *this ) );
    195213        return impCtorDtorStmt;
     
    197215
    198216
    199 Expression *Mutator::mutate( ApplicationExpr *applicationExpr ) {
     217Expression * Mutator::mutate( ApplicationExpr *applicationExpr ) {
    200218        applicationExpr->set_env( maybeMutate( applicationExpr->get_env(), *this ) );
    201219        applicationExpr->set_result( maybeMutate( applicationExpr->get_result(), *this ) );
     
    205223}
    206224
    207 Expression *Mutator::mutate( UntypedExpr *untypedExpr ) {
     225Expression * Mutator::mutate( UntypedExpr *untypedExpr ) {
    208226        untypedExpr->set_env( maybeMutate( untypedExpr->get_env(), *this ) );
    209227        untypedExpr->set_result( maybeMutate( untypedExpr->get_result(), *this ) );
     
    212230}
    213231
    214 Expression *Mutator::mutate( NameExpr *nameExpr ) {
     232Expression * Mutator::mutate( NameExpr *nameExpr ) {
    215233        nameExpr->set_env( maybeMutate( nameExpr->get_env(), *this ) );
    216234        nameExpr->set_result( maybeMutate( nameExpr->get_result(), *this ) );
     
    218236}
    219237
    220 Expression *Mutator::mutate( AddressExpr *addressExpr ) {
     238Expression * Mutator::mutate( AddressExpr *addressExpr ) {
    221239        addressExpr->set_env( maybeMutate( addressExpr->get_env(), *this ) );
    222240        addressExpr->set_result( maybeMutate( addressExpr->get_result(), *this ) );
     
    225243}
    226244
    227 Expression *Mutator::mutate( LabelAddressExpr *labelAddressExpr ) {
     245Expression * Mutator::mutate( LabelAddressExpr *labelAddressExpr ) {
    228246        labelAddressExpr->set_env( maybeMutate( labelAddressExpr->get_env(), *this ) );
    229247        labelAddressExpr->set_result( maybeMutate( labelAddressExpr->get_result(), *this ) );
     
    232250}
    233251
    234 Expression *Mutator::mutate( CastExpr *castExpr ) {
     252Expression * Mutator::mutate( CastExpr *castExpr ) {
    235253        castExpr->set_env( maybeMutate( castExpr->get_env(), *this ) );
    236254        castExpr->set_result( maybeMutate( castExpr->get_result(), *this ) );
     
    239257}
    240258
    241 Expression *Mutator::mutate( VirtualCastExpr *castExpr ) {
     259Expression * Mutator::mutate( VirtualCastExpr *castExpr ) {
    242260        castExpr->set_env( maybeMutate( castExpr->get_env(), *this ) );
    243261        castExpr->set_result( maybeMutate( castExpr->get_result(), *this ) );
     
    246264}
    247265
    248 Expression *Mutator::mutate( UntypedMemberExpr *memberExpr ) {
     266Expression * Mutator::mutate( UntypedMemberExpr *memberExpr ) {
    249267        memberExpr->set_env( maybeMutate( memberExpr->get_env(), *this ) );
    250268        memberExpr->set_result( maybeMutate( memberExpr->get_result(), *this ) );
     
    254272}
    255273
    256 Expression *Mutator::mutate( MemberExpr *memberExpr ) {
     274Expression * Mutator::mutate( MemberExpr *memberExpr ) {
    257275        memberExpr->set_env( maybeMutate( memberExpr->get_env(), *this ) );
    258276        memberExpr->set_result( maybeMutate( memberExpr->get_result(), *this ) );
     
    261279}
    262280
    263 Expression *Mutator::mutate( VariableExpr *variableExpr ) {
     281Expression * Mutator::mutate( VariableExpr *variableExpr ) {
    264282        variableExpr->set_env( maybeMutate( variableExpr->get_env(), *this ) );
    265283        variableExpr->set_result( maybeMutate( variableExpr->get_result(), *this ) );
     
    267285}
    268286
    269 Expression *Mutator::mutate( ConstantExpr *constantExpr ) {
     287Expression * Mutator::mutate( ConstantExpr *constantExpr ) {
    270288        constantExpr->set_env( maybeMutate( constantExpr->get_env(), *this ) );
    271289        constantExpr->set_result( maybeMutate( constantExpr->get_result(), *this ) );
     
    274292}
    275293
    276 Expression *Mutator::mutate( SizeofExpr *sizeofExpr ) {
     294Expression * Mutator::mutate( SizeofExpr *sizeofExpr ) {
    277295        sizeofExpr->set_env( maybeMutate( sizeofExpr->get_env(), *this ) );
    278296        sizeofExpr->set_result( maybeMutate( sizeofExpr->get_result(), *this ) );
     
    285303}
    286304
    287 Expression *Mutator::mutate( AlignofExpr *alignofExpr ) {
     305Expression * Mutator::mutate( AlignofExpr *alignofExpr ) {
    288306        alignofExpr->set_env( maybeMutate( alignofExpr->get_env(), *this ) );
    289307        alignofExpr->set_result( maybeMutate( alignofExpr->get_result(), *this ) );
     
    296314}
    297315
    298 Expression *Mutator::mutate( UntypedOffsetofExpr *offsetofExpr ) {
     316Expression * Mutator::mutate( UntypedOffsetofExpr *offsetofExpr ) {
    299317        offsetofExpr->set_env( maybeMutate( offsetofExpr->get_env(), *this ) );
    300318        offsetofExpr->set_result( maybeMutate( offsetofExpr->get_result(), *this ) );
     
    303321}
    304322
    305 Expression *Mutator::mutate( OffsetofExpr *offsetofExpr ) {
     323Expression * Mutator::mutate( OffsetofExpr *offsetofExpr ) {
    306324        offsetofExpr->set_env( maybeMutate( offsetofExpr->get_env(), *this ) );
    307325        offsetofExpr->set_result( maybeMutate( offsetofExpr->get_result(), *this ) );
     
    311329}
    312330
    313 Expression *Mutator::mutate( OffsetPackExpr *offsetPackExpr ) {
     331Expression * Mutator::mutate( OffsetPackExpr *offsetPackExpr ) {
    314332        offsetPackExpr->set_env( maybeMutate( offsetPackExpr->get_env(), *this ) );
    315333        offsetPackExpr->set_result( maybeMutate( offsetPackExpr->get_result(), *this ) );
     
    318336}
    319337
    320 Expression *Mutator::mutate( AttrExpr *attrExpr ) {
     338Expression * Mutator::mutate( AttrExpr *attrExpr ) {
    321339        attrExpr->set_env( maybeMutate( attrExpr->get_env(), *this ) );
    322340        attrExpr->set_result( maybeMutate( attrExpr->get_result(), *this ) );
     
    329347}
    330348
    331 Expression *Mutator::mutate( LogicalExpr *logicalExpr ) {
     349Expression * Mutator::mutate( LogicalExpr *logicalExpr ) {
    332350        logicalExpr->set_env( maybeMutate( logicalExpr->get_env(), *this ) );
    333351        logicalExpr->set_result( maybeMutate( logicalExpr->get_result(), *this ) );
     
    337355}
    338356
    339 Expression *Mutator::mutate( ConditionalExpr *conditionalExpr ) {
     357Expression * Mutator::mutate( ConditionalExpr *conditionalExpr ) {
    340358        conditionalExpr->set_env( maybeMutate( conditionalExpr->get_env(), *this ) );
    341359        conditionalExpr->set_result( maybeMutate( conditionalExpr->get_result(), *this ) );
     
    346364}
    347365
    348 Expression *Mutator::mutate( CommaExpr *commaExpr ) {
     366Expression * Mutator::mutate( CommaExpr *commaExpr ) {
    349367        commaExpr->set_env( maybeMutate( commaExpr->get_env(), *this ) );
    350368        commaExpr->set_result( maybeMutate( commaExpr->get_result(), *this ) );
     
    354372}
    355373
    356 Expression *Mutator::mutate( TypeExpr *typeExpr ) {
     374Expression * Mutator::mutate( TypeExpr *typeExpr ) {
    357375        typeExpr->set_env( maybeMutate( typeExpr->get_env(), *this ) );
    358376        typeExpr->set_result( maybeMutate( typeExpr->get_result(), *this ) );
     
    361379}
    362380
    363 Expression *Mutator::mutate( AsmExpr *asmExpr ) {
     381Expression * Mutator::mutate( AsmExpr *asmExpr ) {
    364382        asmExpr->set_env( maybeMutate( asmExpr->get_env(), *this ) );
    365383        asmExpr->set_inout( maybeMutate( asmExpr->get_inout(), *this ) );
     
    386404}
    387405
    388 Expression *Mutator::mutate( CompoundLiteralExpr *compLitExpr ) {
     406Expression * Mutator::mutate( CompoundLiteralExpr *compLitExpr ) {
    389407        compLitExpr->set_env( maybeMutate( compLitExpr->get_env(), *this ) );
    390408        compLitExpr->set_result( maybeMutate( compLitExpr->get_result(), *this ) );
     
    393411}
    394412
    395 Expression *Mutator::mutate( RangeExpr *rangeExpr ) {
     413Expression * Mutator::mutate( RangeExpr *rangeExpr ) {
    396414        rangeExpr->set_env( maybeMutate( rangeExpr->get_env(), *this ) );
    397415        rangeExpr->set_low( maybeMutate( rangeExpr->get_low(), *this ) );
     
    400418}
    401419
    402 Expression *Mutator::mutate( UntypedTupleExpr *tupleExpr ) {
     420Expression * Mutator::mutate( UntypedTupleExpr *tupleExpr ) {
    403421        tupleExpr->set_env( maybeMutate( tupleExpr->get_env(), *this ) );
    404422        tupleExpr->set_result( maybeMutate( tupleExpr->get_result(), *this ) );
     
    407425}
    408426
    409 Expression *Mutator::mutate( TupleExpr *tupleExpr ) {
     427Expression * Mutator::mutate( TupleExpr *tupleExpr ) {
    410428        tupleExpr->set_env( maybeMutate( tupleExpr->get_env(), *this ) );
    411429        tupleExpr->set_result( maybeMutate( tupleExpr->get_result(), *this ) );
     
    414432}
    415433
    416 Expression *Mutator::mutate( TupleIndexExpr *tupleExpr ) {
     434Expression * Mutator::mutate( TupleIndexExpr *tupleExpr ) {
    417435        tupleExpr->set_env( maybeMutate( tupleExpr->get_env(), *this ) );
    418436        tupleExpr->set_result( maybeMutate( tupleExpr->get_result(), *this ) );
     
    421439}
    422440
    423 Expression *Mutator::mutate( TupleAssignExpr *assignExpr ) {
     441Expression * Mutator::mutate( TupleAssignExpr *assignExpr ) {
    424442        assignExpr->set_env( maybeMutate( assignExpr->get_env(), *this ) );
    425443        assignExpr->set_result( maybeMutate( assignExpr->get_result(), *this ) );
     
    428446}
    429447
    430 Expression *Mutator::mutate( StmtExpr *stmtExpr ) {
     448Expression * Mutator::mutate( StmtExpr *stmtExpr ) {
    431449        stmtExpr->set_env( maybeMutate( stmtExpr->get_env(), *this ) );
    432450        stmtExpr->set_result( maybeMutate( stmtExpr->get_result(), *this ) );
     
    437455}
    438456
    439 Expression *Mutator::mutate( UniqueExpr *uniqueExpr ) {
     457Expression * Mutator::mutate( UniqueExpr *uniqueExpr ) {
    440458        uniqueExpr->set_env( maybeMutate( uniqueExpr->get_env(), *this ) );
    441459        uniqueExpr->set_result( maybeMutate( uniqueExpr->get_result(), *this ) );
     
    444462}
    445463
    446 Expression *Mutator::mutate( UntypedInitExpr * initExpr ) {
     464Expression * Mutator::mutate( UntypedInitExpr * initExpr ) {
    447465        initExpr->set_env( maybeMutate( initExpr->get_env(), *this ) );
    448466        initExpr->set_result( maybeMutate( initExpr->get_result(), *this ) );
     
    452470}
    453471
    454 Expression *Mutator::mutate( InitExpr * initExpr ) {
     472Expression * Mutator::mutate( InitExpr * initExpr ) {
    455473        initExpr->set_env( maybeMutate( initExpr->get_env(), *this ) );
    456474        initExpr->set_result( maybeMutate( initExpr->get_result(), *this ) );
     
    461479
    462480
    463 Type *Mutator::mutate( VoidType *voidType ) {
     481Type * Mutator::mutate( VoidType *voidType ) {
    464482        mutateAll( voidType->get_forall(), *this );
    465483        return voidType;
    466484}
    467485
    468 Type *Mutator::mutate( BasicType *basicType ) {
     486Type * Mutator::mutate( BasicType *basicType ) {
    469487        mutateAll( basicType->get_forall(), *this );
    470488        return basicType;
    471489}
    472490
    473 Type *Mutator::mutate( PointerType *pointerType ) {
     491Type * Mutator::mutate( PointerType *pointerType ) {
    474492        mutateAll( pointerType->get_forall(), *this );
    475493        pointerType->set_base( maybeMutate( pointerType->get_base(), *this ) );
     
    477495}
    478496
    479 Type *Mutator::mutate( ArrayType *arrayType ) {
     497Type * Mutator::mutate( ArrayType *arrayType ) {
    480498        mutateAll( arrayType->get_forall(), *this );
    481499        arrayType->set_dimension( maybeMutate( arrayType->get_dimension(), *this ) );
     
    484502}
    485503
    486 Type *Mutator::mutate( ReferenceType *refType ) {
     504Type * Mutator::mutate( ReferenceType * refType ) {
    487505        mutateAll( refType->get_forall(), *this );
    488506        refType->set_base( maybeMutate( refType->get_base(), *this ) );
     
    490508}
    491509
    492 Type *Mutator::mutate( FunctionType *functionType ) {
     510Type * Mutator::mutate( FunctionType * functionType ) {
    493511        mutateAll( functionType->get_forall(), *this );
    494512        mutateAll( functionType->get_returnVals(), *this );
     
    497515}
    498516
    499 Type *Mutator::handleReferenceToType( ReferenceToType *aggregateUseType ) {
     517Type * Mutator::handleReferenceToType( ReferenceToType *aggregateUseType ) {
    500518        mutateAll( aggregateUseType->get_forall(), *this );
    501519        mutateAll( aggregateUseType->get_parameters(), *this );
     
    503521}
    504522
    505 Type *Mutator::mutate( StructInstType *aggregateUseType ) {
     523Type * Mutator::mutate( StructInstType *aggregateUseType ) {
    506524        handleReferenceToType( aggregateUseType );
    507525        return aggregateUseType;
    508526}
    509527
    510 Type *Mutator::mutate( UnionInstType *aggregateUseType ) {
     528Type * Mutator::mutate( UnionInstType *aggregateUseType ) {
    511529        handleReferenceToType( aggregateUseType );
    512530        return aggregateUseType;
    513531}
    514532
    515 Type *Mutator::mutate( EnumInstType *aggregateUseType ) {
     533Type * Mutator::mutate( EnumInstType *aggregateUseType ) {
    516534        handleReferenceToType( aggregateUseType );
    517535        return aggregateUseType;
    518536}
    519537
    520 Type *Mutator::mutate( TraitInstType *aggregateUseType ) {
     538Type * Mutator::mutate( TraitInstType *aggregateUseType ) {
    521539        handleReferenceToType( aggregateUseType );
    522540        mutateAll( aggregateUseType->get_members(), *this );
     
    524542}
    525543
    526 Type *Mutator::mutate( TypeInstType *aggregateUseType ) {
     544Type * Mutator::mutate( TypeInstType *aggregateUseType ) {
    527545        handleReferenceToType( aggregateUseType );
    528546        return aggregateUseType;
    529547}
    530548
    531 Type *Mutator::mutate( TupleType *tupleType ) {
     549Type * Mutator::mutate( TupleType *tupleType ) {
    532550        mutateAll( tupleType->get_forall(), *this );
    533551        mutateAll( tupleType->get_types(), *this );
     
    536554}
    537555
    538 Type *Mutator::mutate( TypeofType *typeofType ) {
     556Type * Mutator::mutate( TypeofType *typeofType ) {
    539557        assert( typeofType->get_expr() );
    540558        typeofType->set_expr( typeofType->get_expr()->acceptMutator( *this ) );
     
    542560}
    543561
    544 Type *Mutator::mutate( AttrType *attrType ) {
     562Type * Mutator::mutate( AttrType *attrType ) {
    545563        if ( attrType->get_isType() ) {
    546564                assert( attrType->get_type() );
     
    553571}
    554572
    555 Type *Mutator::mutate( VarArgsType *varArgsType ) {
     573Type * Mutator::mutate( VarArgsType *varArgsType ) {
    556574        mutateAll( varArgsType->get_forall(), *this );
    557575        return varArgsType;
    558576}
    559577
    560 Type *Mutator::mutate( ZeroType *zeroType ) {
     578Type * Mutator::mutate( ZeroType *zeroType ) {
    561579        mutateAll( zeroType->get_forall(), *this );
    562580        return zeroType;
    563581}
    564582
    565 Type *Mutator::mutate( OneType *oneType ) {
     583Type * Mutator::mutate( OneType *oneType ) {
    566584        mutateAll( oneType->get_forall(), *this );
    567585        return oneType;
     
    569587
    570588
    571 Designation *Mutator::mutate( Designation * designation ) {
     589Designation * Mutator::mutate( Designation * designation ) {
    572590        mutateAll( designation->get_designators(), *this );
    573591        return designation;
    574592}
    575593
    576 Initializer *Mutator::mutate( SingleInit *singleInit ) {
     594Initializer * Mutator::mutate( SingleInit *singleInit ) {
    577595        singleInit->set_value( singleInit->get_value()->acceptMutator( *this ) );
    578596        return singleInit;
    579597}
    580598
    581 Initializer *Mutator::mutate( ListInit *listInit ) {
     599Initializer * Mutator::mutate( ListInit *listInit ) {
    582600        mutateAll( listInit->get_designations(), *this );
    583601        mutateAll( listInit->get_initializers(), *this );
     
    585603}
    586604
    587 Initializer *Mutator::mutate( ConstructorInit *ctorInit ) {
     605Initializer * Mutator::mutate( ConstructorInit *ctorInit ) {
    588606        ctorInit->set_ctor( maybeMutate( ctorInit->get_ctor(), *this ) );
    589607        ctorInit->set_dtor( maybeMutate( ctorInit->get_dtor(), *this ) );
     
    593611
    594612
    595 Subrange *Mutator::mutate( Subrange *subrange ) {
     613Subrange * Mutator::mutate( Subrange *subrange ) {
    596614        return subrange;
    597615}
    598616
    599617
    600 Constant *Mutator::mutate( Constant *constant ) {
     618Constant * Mutator::mutate( Constant *constant ) {
    601619        return constant;
    602620}
  • src/SynTree/Mutator.h

    r0c6596f r1cb758f2  
    4949        virtual Statement* mutate( CatchStmt *catchStmt );
    5050        virtual Statement* mutate( FinallyStmt *catchStmt );
     51        virtual Statement* mutate( WaitForStmt *waitforStmt );
    5152        virtual NullStmt* mutate( NullStmt *nullStmt );
    5253        virtual Statement* mutate( DeclStmt *declStmt );
  • src/SynTree/Statement.cc

    r0c6596f r1cb758f2  
    419419}
    420420
     421WaitForStmt::WaitForStmt( std::list<Label> labels ) : Statement( labels ) {
     422        timeout.time      = nullptr;
     423        timeout.statement = nullptr;
     424        timeout.condition = nullptr;
     425        orelse .statement = nullptr;
     426        orelse .condition = nullptr;
     427}
     428
     429WaitForStmt::WaitForStmt( const WaitForStmt & other ) : Statement( other ) {
     430        clauses.reserve( other.clauses.size() );
     431        for( auto & ocl : other.clauses ) {
     432                clauses.emplace_back();
     433                clauses.back().target.function = ocl.target.function->clone();
     434                cloneAll( ocl.target.arguments, clauses.back().target.arguments );
     435                clauses.back().statement = ocl.statement->clone();
     436                clauses.back().condition = ocl.condition->clone();
     437        }
     438
     439        timeout.time      = other.timeout.time     ->clone();
     440        timeout.statement = other.timeout.statement->clone();
     441        timeout.condition = other.timeout.condition->clone();
     442        orelse .statement = other.orelse .statement->clone();
     443        orelse .condition = other.orelse .condition->clone();
     444}
     445
     446WaitForStmt::~WaitForStmt() {
     447        for( auto & clause : clauses ) {
     448                delete clause.target.function;
     449                deleteAll( clause.target.arguments );
     450                delete clause.statement;
     451                delete clause.condition;
     452        }
     453
     454        delete timeout.time;
     455        delete timeout.statement;
     456        delete timeout.condition;
     457
     458        delete orelse.statement;
     459        delete orelse.condition;
     460}
     461
     462void WaitForStmt::print( std::ostream &os, int indent ) const {
     463        os << "Waitfor Statement" << endl;
     464        os << string( indent + 2, ' ' ) << "with block:" << endl;
     465        os << string( indent + 4, ' ' );
     466        // block->print( os, indent + 4 );
     467}
     468
    421469NullStmt::NullStmt( std::list<Label> labels ) : CompoundStmt( labels ) {}
    422470NullStmt::NullStmt() : CompoundStmt( std::list<Label>() ) {}
  • src/SynTree/Statement.h

    r0c6596f r1cb758f2  
    1919#include <list>                    // for list
    2020#include <memory>                  // for allocator
     21#include <vector>                        // for vector
    2122
    2223#include "BaseSyntaxNode.h"        // for BaseSyntaxNode
     
    392393};
    393394
     395class WaitForStmt : public Statement {
     396  public:
     397
     398        struct Target {
     399                Expression * function;
     400                std::list<Expression * > arguments;
     401        };
     402
     403        struct Clause {
     404                Target       target;
     405                Statement  * statement;
     406                Expression * condition;
     407        };
     408
     409        WaitForStmt( std::list<Label> labels = noLabels );
     410        WaitForStmt( const WaitForStmt & );
     411        virtual ~WaitForStmt();
     412
     413        std::vector<Clause> clauses;
     414
     415        struct {
     416                Expression * time;
     417                Statement  * statement;
     418                Expression * condition;
     419        } timeout;
     420
     421        struct {
     422                Statement  * statement;
     423                Expression * condition;
     424        } orelse;
     425
     426        virtual WaitForStmt *clone() const { return new WaitForStmt( *this ); }
     427        virtual void accept( Visitor &v ) { v.visit( this ); }
     428        virtual Statement *acceptMutator( Mutator &m ) { return m.mutate( this ); }
     429        virtual void print( std::ostream &os, int indent = 0 ) const;
     430
     431};
     432
    394433
    395434// represents a declaration that occurs as part of a compound statement
  • src/SynTree/SynTree.h

    r0c6596f r1cb758f2  
    5454class CatchStmt;
    5555class FinallyStmt;
     56class WaitForStmt;
    5657class NullStmt;
    5758class DeclStmt;
  • src/SynTree/Visitor.cc

    r0c6596f r1cb758f2  
    155155}
    156156
     157void Visitor::visit( WaitForStmt *waitforStmt ) {
     158        for( auto & clause : waitforStmt->clauses ) {
     159                maybeAccept( clause.target.function, *this );
     160                acceptAll( clause.target.arguments, *this );
     161
     162                maybeAccept( clause.statement, *this );
     163                maybeAccept( clause.condition, *this );
     164        }
     165
     166        maybeAccept( waitforStmt->timeout.time, *this );
     167        maybeAccept( waitforStmt->timeout.statement, *this );
     168        maybeAccept( waitforStmt->timeout.condition, *this );
     169        maybeAccept( waitforStmt->orelse.statement, *this );
     170        maybeAccept( waitforStmt->orelse.condition, *this );
     171}
     172
    157173void Visitor::visit( __attribute__((unused)) NullStmt *nullStmt ) {
    158174}
  • src/SynTree/Visitor.h

    r0c6596f r1cb758f2  
    5151        virtual void visit( CatchStmt *catchStmt );
    5252        virtual void visit( FinallyStmt *finallyStmt );
     53        virtual void visit( WaitForStmt *waitforStmt );
    5354        virtual void visit( NullStmt *nullStmt );
    5455        virtual void visit( DeclStmt *declStmt );
Note: See TracChangeset for help on using the changeset viewer.