Ignore:
Timestamp:
Mar 14, 2018, 1:19:39 PM (4 years ago)
Author:
Rob Schluntz <rschlunt@…>
Branches:
aaron-thesis, arm-eh, cleanup-dtors, deferred_resn, demangler, jacob/cs343-translation, jenkins-sandbox, master, new-ast, new-ast-unique-expr, new-env, no_list, persistent-indexer, with_gc
Children:
720a007
Parents:
e2c70ab
Message:

Update parser for new fallthrough semantics

File:
1 edited

Legend:

Unmodified
Added
Removed
  • src/Parser/StatementNode.cc

    re2c70ab r6a276a0  
    1010// Created On       : Sat May 16 14:59:41 2015
    1111// Last Modified By : Peter A. Buhr
    12 // Last Modified On : Fri Sep  1 23:25:23 2017
    13 // Update Count     : 346
     12// Last Modified On : Thu Mar  8 14:31:32 2018
     13// Update Count     : 348
    1414//
    1515
     
    116116}
    117117
    118 Statement *build_switch( ExpressionNode *ctl, StatementNode *stmt ) {
     118Statement *build_switch( bool isSwitch, ExpressionNode *ctl, StatementNode *stmt ) {
    119119        std::list< Statement * > branches;
    120120        buildMoveList< Statement, StatementNode >( stmt, branches );
     121        if ( ! isSwitch ) {                                                                             // choose statement
     122                for ( Statement * stmt : branches ) {
     123                        CaseStmt * caseStmt = strict_dynamic_cast< CaseStmt * >( stmt );
     124                        if ( ! caseStmt->stmts.empty() ) {                      // code after "case" => end of case list
     125                                CompoundStmt * block = strict_dynamic_cast< CompoundStmt * >( caseStmt->stmts.front() );
     126                                block->kids.push_back( new BranchStmt( "", BranchStmt::Break ) );
     127                        } // if
     128                } // for
     129        } // if
    121130        // branches.size() == 0 for switch (...) {}, i.e., no declaration or statements
    122131        return new SwitchStmt( maybeMoveBuild< Expression >(ctl), branches );
Note: See TracChangeset for help on using the changeset viewer.