Ignore:
File:
1 edited

Legend:

Unmodified
Added
Removed
  • src/Parser/StatementNode.cc

    ra67b60e rc0aa336  
    1010// Created On       : Sat May 16 14:59:41 2015
    1111// Last Modified By : Peter A. Buhr
    12 // Last Modified On : Wed Jun 28 21:08:37 2017
    13 // Update Count     : 330
     12// Last Modified On : Thu Feb  2 22:16:40 2017
     13// Update Count     : 327
    1414//
    1515
     
    2121#include "SynTree/Statement.h"
    2222#include "SynTree/Expression.h"
    23 #include "parserutility.h"
     23#include "parseutility.h"
    2424#include "Common/utility.h"
    2525
     
    152152        return new ReturnStmt( noLabels, exps.size() > 0 ? exps.back() : nullptr );
    153153}
    154 
    155154Statement *build_throw( ExpressionNode *ctl ) {
    156155        std::list< Expression * > exps;
    157156        buildMoveList( ctl, exps );
    158157        assertf( exps.size() < 2, "This means we are leaking memory");
    159         return new ThrowStmt( noLabels, ThrowStmt::Terminate, !exps.empty() ? exps.back() : nullptr );
    160 }
    161 
    162 Statement *build_resume( ExpressionNode *ctl ) {
    163         std::list< Expression * > exps;
    164         buildMoveList( ctl, exps );
    165         assertf( exps.size() < 2, "This means we are leaking memory");
    166         return new ThrowStmt( noLabels, ThrowStmt::Resume, !exps.empty() ? exps.back() : nullptr );
    167 }
    168 
    169 Statement *build_resume_at( ExpressionNode *ctl, ExpressionNode *target ) {
    170         (void)ctl;
    171         (void)target;
    172         assertf( false, "resume at (non-local throw) is not yet supported," );
     158        return new ReturnStmt( noLabels, !exps.empty() ? exps.back() : nullptr, true );
    173159}
    174160
    175161Statement *build_try( StatementNode *try_stmt, StatementNode *catch_stmt, StatementNode *finally_stmt ) {
    176         std::list< CatchStmt * > branches;
    177         buildMoveList< CatchStmt, StatementNode >( catch_stmt, branches );
     162        std::list< Statement * > branches;
     163        buildMoveList< Statement, StatementNode >( catch_stmt, branches );
    178164        CompoundStmt *tryBlock = safe_dynamic_cast< CompoundStmt * >(maybeMoveBuild< Statement >(try_stmt));
    179165        FinallyStmt *finallyBlock = dynamic_cast< FinallyStmt * >(maybeMoveBuild< Statement >(finally_stmt) );
    180166        return new TryStmt( noLabels, tryBlock, branches, finallyBlock );
    181167}
    182 Statement *build_catch( CatchStmt::Kind kind, DeclarationNode *decl, ExpressionNode *cond, StatementNode *body ) {
    183         std::list< Statement * > branches;
    184         buildMoveList< Statement, StatementNode >( body, branches );
    185         assert( branches.size() == 1 );
    186         return new CatchStmt( noLabels, kind, maybeMoveBuild< Declaration >(decl), maybeMoveBuild< Expression >(cond), branches.front() );
     168Statement *build_catch( DeclarationNode *decl, StatementNode *stmt, bool catchAny ) {
     169        std::list< Statement * > branches;
     170        buildMoveList< Statement, StatementNode >( stmt, branches );
     171        assert( branches.size() == 1 );
     172        return new CatchStmt( noLabels, maybeMoveBuild< Declaration >(decl), branches.front(), catchAny );
    187173}
    188174Statement *build_finally( StatementNode *stmt ) {
Note: See TracChangeset for help on using the changeset viewer.