Changes in src/Parser/StatementNode.cc [a67b60e:c0aa336]
- File:
-
- 1 edited
-
src/Parser/StatementNode.cc (modified) (3 diffs)
Legend:
- Unmodified
- Added
- Removed
-
src/Parser/StatementNode.cc
ra67b60e rc0aa336 10 10 // Created On : Sat May 16 14:59:41 2015 11 11 // Last Modified By : Peter A. Buhr 12 // Last Modified On : Wed Jun 28 21:08:37201713 // Update Count : 3 3012 // Last Modified On : Thu Feb 2 22:16:40 2017 13 // Update Count : 327 14 14 // 15 15 … … 21 21 #include "SynTree/Statement.h" 22 22 #include "SynTree/Expression.h" 23 #include "parse rutility.h"23 #include "parseutility.h" 24 24 #include "Common/utility.h" 25 25 … … 152 152 return new ReturnStmt( noLabels, exps.size() > 0 ? exps.back() : nullptr ); 153 153 } 154 155 154 Statement *build_throw( ExpressionNode *ctl ) { 156 155 std::list< Expression * > exps; 157 156 buildMoveList( ctl, exps ); 158 157 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 ); 173 159 } 174 160 175 161 Statement *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 ); 178 164 CompoundStmt *tryBlock = safe_dynamic_cast< CompoundStmt * >(maybeMoveBuild< Statement >(try_stmt)); 179 165 FinallyStmt *finallyBlock = dynamic_cast< FinallyStmt * >(maybeMoveBuild< Statement >(finally_stmt) ); 180 166 return new TryStmt( noLabels, tryBlock, branches, finallyBlock ); 181 167 } 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());168 Statement *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 ); 187 173 } 188 174 Statement *build_finally( StatementNode *stmt ) {
Note:
See TracChangeset
for help on using the changeset viewer.