Changeset 3ca540f for src/Parser


Ignore:
Timestamp:
Dec 1, 2017, 2:55:41 PM (6 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:
a40d503
Parents:
882ad37 (diff), 5da9d6a (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 with-statement

File:
1 edited

Legend:

Unmodified
Added
Removed
  • src/Parser/StatementNode.cc

    r882ad37 r3ca540f  
    3737        DeclarationNode *agg = decl->extractAggregate();
    3838        if ( agg ) {
    39                 StatementNode *nextStmt = new StatementNode( new DeclStmt( noLabels, maybeBuild< Declaration >( decl ) ) );
     39                StatementNode *nextStmt = new StatementNode( new DeclStmt( maybeBuild< Declaration >( decl ) ) );
    4040                set_next( nextStmt );
    4141                if ( decl->get_next() ) {
     
    5050                agg = decl;
    5151        } // if
    52         stmt.reset( new DeclStmt( noLabels, maybeMoveBuild< Declaration >(agg) ) );
     52        stmt.reset( new DeclStmt( maybeMoveBuild< Declaration >(agg) ) );
    5353} // StatementNode::StatementNode
    5454
     
    7575
    7676        if ( e )
    77                 return new ExprStmt( noLabels, e );
     77                return new ExprStmt( e );
    7878        else
    79                 return new NullStmt( noLabels );
     79                return new NullStmt();
    8080}
    8181
     
    113113        }
    114114        delete ctl;
    115         return new IfStmt( noLabels, cond, thenb, elseb, init );
     115        return new IfStmt( cond, thenb, elseb, init );
    116116}
    117117
     
    120120        buildMoveList< Statement, StatementNode >( stmt, branches );
    121121        // branches.size() == 0 for switch (...) {}, i.e., no declaration or statements
    122         return new SwitchStmt( noLabels, maybeMoveBuild< Expression >(ctl), branches );
     122        return new SwitchStmt( maybeMoveBuild< Expression >(ctl), branches );
    123123}
    124124Statement *build_case( ExpressionNode *ctl ) {
    125125        std::list< Statement * > branches;
    126         return new CaseStmt( noLabels, maybeMoveBuild< Expression >(ctl), branches );
     126        return new CaseStmt( maybeMoveBuild< Expression >(ctl), branches );
    127127}
    128128Statement *build_default() {
    129129        std::list< Statement * > branches;
    130         return new CaseStmt( noLabels, nullptr, branches, true );
     130        return new CaseStmt( nullptr, branches, true );
    131131}
    132132
     
    135135        buildMoveList< Statement, StatementNode >( stmt, branches );
    136136        assert( branches.size() == 1 );
    137         return new WhileStmt( noLabels, notZeroExpr( maybeMoveBuild< Expression >(ctl) ), branches.front(), kind );
     137        return new WhileStmt( notZeroExpr( maybeMoveBuild< Expression >(ctl) ), branches.front(), kind );
    138138}
    139139
     
    157157
    158158        delete forctl;
    159         return new ForStmt( noLabels, init, cond, incr, branches.front() );
     159        return new ForStmt( init, cond, incr, branches.front() );
    160160}
    161161
    162162Statement *build_branch( BranchStmt::Type kind ) {
    163         Statement * ret = new BranchStmt( noLabels, "", kind );
     163        Statement * ret = new BranchStmt( "", kind );
    164164        return ret;
    165165}
    166166Statement *build_branch( std::string *identifier, BranchStmt::Type kind ) {
    167         Statement * ret = new BranchStmt( noLabels, *identifier, kind );
     167        Statement * ret = new BranchStmt( *identifier, kind );
    168168        delete identifier;                                                                      // allocated by lexer
    169169        return ret;
    170170}
    171171Statement *build_computedgoto( ExpressionNode *ctl ) {
    172         return new BranchStmt( noLabels, maybeMoveBuild< Expression >(ctl), BranchStmt::Goto );
     172        return new BranchStmt( maybeMoveBuild< Expression >(ctl), BranchStmt::Goto );
    173173}
    174174
     
    176176        std::list< Expression * > exps;
    177177        buildMoveList( ctl, exps );
    178         return new ReturnStmt( noLabels, exps.size() > 0 ? exps.back() : nullptr );
     178        return new ReturnStmt( exps.size() > 0 ? exps.back() : nullptr );
    179179}
    180180
     
    183183        buildMoveList( ctl, exps );
    184184        assertf( exps.size() < 2, "This means we are leaking memory");
    185         return new ThrowStmt( noLabels, ThrowStmt::Terminate, !exps.empty() ? exps.back() : nullptr );
     185        return new ThrowStmt( ThrowStmt::Terminate, !exps.empty() ? exps.back() : nullptr );
    186186}
    187187
     
    190190        buildMoveList( ctl, exps );
    191191        assertf( exps.size() < 2, "This means we are leaking memory");
    192         return new ThrowStmt( noLabels, ThrowStmt::Resume, !exps.empty() ? exps.back() : nullptr );
     192        return new ThrowStmt( ThrowStmt::Resume, !exps.empty() ? exps.back() : nullptr );
    193193}
    194194
     
    204204        CompoundStmt *tryBlock = strict_dynamic_cast< CompoundStmt * >(maybeMoveBuild< Statement >(try_stmt));
    205205        FinallyStmt *finallyBlock = dynamic_cast< FinallyStmt * >(maybeMoveBuild< Statement >(finally_stmt) );
    206         return new TryStmt( noLabels, tryBlock, branches, finallyBlock );
     206        return new TryStmt( tryBlock, branches, finallyBlock );
    207207}
    208208Statement *build_catch( CatchStmt::Kind kind, DeclarationNode *decl, ExpressionNode *cond, StatementNode *body ) {
     
    210210        buildMoveList< Statement, StatementNode >( body, branches );
    211211        assert( branches.size() == 1 );
    212         return new CatchStmt( noLabels, kind, maybeMoveBuild< Declaration >(decl), maybeMoveBuild< Expression >(cond), branches.front() );
     212        return new CatchStmt( kind, maybeMoveBuild< Declaration >(decl), maybeMoveBuild< Expression >(cond), branches.front() );
    213213}
    214214Statement *build_finally( StatementNode *stmt ) {
     
    216216        buildMoveList< Statement, StatementNode >( stmt, branches );
    217217        assert( branches.size() == 1 );
    218         return new FinallyStmt( noLabels, dynamic_cast< CompoundStmt * >( branches.front() ) );
     218        return new FinallyStmt( dynamic_cast< CompoundStmt * >( branches.front() ) );
    219219}
    220220
     
    296296
    297297Statement *build_compound( StatementNode *first ) {
    298         CompoundStmt *cs = new CompoundStmt( noLabels );
     298        CompoundStmt *cs = new CompoundStmt();
    299299        buildMoveList( first, cs->get_kids() );
    300300        return cs;
     
    308308        buildMoveList( input, in );
    309309        buildMoveList( clobber, clob );
    310         return new AsmStmt( noLabels, voltile, instruction, out, in, clob, gotolabels ? gotolabels->labels : noLabels );
     310        return new AsmStmt( voltile, instruction, out, in, clob, gotolabels ? gotolabels->labels : noLabels );
    311311}
    312312
Note: See TracChangeset for help on using the changeset viewer.