Changeset 4e7171f
- Timestamp:
- Feb 2, 2022, 1:45:19 PM (2 years ago)
- Branches:
- ADT, ast-experimental, enum, forall-pointer-decay, master, pthread-emulation, qualifiedEnum
- Children:
- 17cb385, 6180274, 8cb149f
- Parents:
- ff3b0249
- Location:
- src
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
src/Parser/StatementNode.cc
rff3b0249 r4e7171f 5 5 // file "LICENCE" distributed with Cforall. 6 6 // 7 // StatementNode.cc -- 7 // StatementNode.cc -- Transform from parse data-structures to AST data-structures, usually deleting the parse 8 // data-structure after the transformation. 8 9 // 9 10 // Author : Rodolfo G. Esteves 10 11 // Created On : Sat May 16 14:59:41 2015 11 12 // Last Modified By : Peter A. Buhr 12 // Last Modified On : Wed Feb 2 09:45:28 202213 // Update Count : 4 1513 // Last Modified On : Wed Feb 2 12:27:58 2022 14 // Update Count : 424 14 15 // 15 16 … … 137 138 138 139 Statement * build_case( ExpressionNode * ctl ) { 139 return new CaseStmt( maybeMoveBuild< Expression >(ctl), list< Statement * >{} );140 return new CaseStmt( maybeMoveBuild< Expression >(ctl), {} ); // no init 140 141 } // build_case 141 142 142 143 Statement * build_default() { 143 return new CaseStmt( nullptr, list< Statement * >{}, true );144 return new CaseStmt( nullptr, {}, true ); // no init 144 145 } // build_default 145 146 … … 159 160 160 161 Statement * build_do_while( ExpressionNode * ctl, StatementNode * stmt, StatementNode * else_ ) { 161 // do-while cannot have declarations in the contitional, so always empty162 list< Statement * > astinit;163 164 162 list< Statement * > aststmt; // loop body, compound created if empty 165 163 buildMoveList< Statement, StatementNode >( stmt, aststmt ); … … 169 167 buildMoveList< Statement, StatementNode >( else_, astelse ); 170 168 171 return new WhileDoStmt( notZeroExpr( maybeMoveBuild< Expression >(ctl) ), aststmt.front(), astelse.front(), astinit, true ); 169 // do-while cannot have declarations in the contitional, so init is always empty 170 return new WhileDoStmt( notZeroExpr( maybeMoveBuild< Expression >(ctl) ), aststmt.front(), astelse.front(), {}, true ); 172 171 } // build_do_while 173 172 -
src/SynTree/Statement.cc
rff3b0249 r4e7171f 10 10 // Created On : Mon May 18 07:44:20 2015 11 11 // Last Modified By : Peter A. Buhr 12 // Last Modified On : Tue Feb 1 17:55:29 202213 // Update Count : 7912 // Last Modified On : Wed Feb 2 11:55:19 2022 13 // Update Count : 80 14 14 // 15 15 … … 246 246 } 247 247 248 WhileDoStmt::WhileDoStmt( Expression * condition, Statement * body, std::list< Statement * > & initialization, bool isDoWhile ):248 WhileDoStmt::WhileDoStmt( Expression * condition, Statement * body, const std::list< Statement * > & initialization, bool isDoWhile ): 249 249 Statement(), condition( condition ), body( body ), else_( nullptr ), initialization( initialization ), isDoWhile( isDoWhile) { 250 250 } 251 251 252 WhileDoStmt::WhileDoStmt( Expression * condition, Statement * body, Statement * else_, std::list< Statement * > & initialization, bool isDoWhile ):252 WhileDoStmt::WhileDoStmt( Expression * condition, Statement * body, Statement * else_, const std::list< Statement * > & initialization, bool isDoWhile ): 253 253 Statement(), condition( condition), body( body ), else_( else_ ), initialization( initialization ), isDoWhile( isDoWhile) { 254 254 } -
src/SynTree/Statement.h
rff3b0249 r4e7171f 10 10 // Created On : Mon May 18 07:44:20 2015 11 11 // Last Modified By : Peter A. Buhr 12 // Last Modified On : Tue Feb 1 17:07:32202213 // Update Count : 9 312 // Last Modified On : Wed Feb 2 11:49:17 2022 13 // Update Count : 94 14 14 // 15 15 … … 233 233 bool isDoWhile; 234 234 235 WhileDoStmt( Expression * condition, Statement * body, std::list<Statement *> & initialization, bool isDoWhile = false );236 WhileDoStmt( Expression * condition, Statement * body, Statement * els ,std::list<Statement *> & initialization, bool isDoWhile = false );235 WhileDoStmt( Expression * condition, Statement * body, const std::list<Statement *> & initialization, bool isDoWhile = false ); 236 WhileDoStmt( Expression * condition, Statement * body, Statement * else_, const std::list<Statement *> & initialization, bool isDoWhile = false ); 237 237 WhileDoStmt( const WhileDoStmt & other ); 238 238 virtual ~WhileDoStmt();
Note: See TracChangeset
for help on using the changeset viewer.