Changeset 3b0bc16 for src/SynTree/Statement.h
- Timestamp:
- Feb 1, 2022, 8:22:12 PM (2 years ago)
- Branches:
- ADT, ast-experimental, enum, forall-pointer-decay, master, pthread-emulation, qualifiedEnum
- Children:
- fde0a58
- Parents:
- 729c991
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
src/SynTree/Statement.h
r729c991 r3b0bc16 10 10 // Created On : Mon May 18 07:44:20 2015 11 11 // Last Modified By : Peter A. Buhr 12 // Last Modified On : Fri Jan 10 14:13:24 202013 // Update Count : 8512 // Last Modified On : Tue Feb 1 17:07:32 2022 13 // Update Count : 93 14 14 // 15 15 … … 148 148 public: 149 149 Expression * condition; 150 Statement * then Part;151 Statement * else Part;150 Statement * then; 151 Statement * else_; 152 152 std::list<Statement *> initialization; 153 153 154 IfStmt( Expression * condition, Statement * then Part, Statement * elsePart,154 IfStmt( Expression * condition, Statement * then, Statement * else_, 155 155 std::list<Statement *> initialization = std::list<Statement *>() ); 156 156 IfStmt( const IfStmt & other ); … … 160 160 Expression * get_condition() { return condition; } 161 161 void set_condition( Expression * newValue ) { condition = newValue; } 162 Statement * get_then Part() { return thenPart; }163 void set_then Part( Statement * newValue ) { thenPart= newValue; }164 Statement * get_else Part() { return elsePart; }165 void set_else Part( Statement * newValue ) { elsePart= newValue; }162 Statement * get_then() { return then; } 163 void set_then( Statement * newValue ) { then = newValue; } 164 Statement * get_else() { return else_; } 165 void set_else( Statement * newValue ) { else_ = newValue; } 166 166 167 167 virtual IfStmt * clone() const override { return new IfStmt( *this ); } … … 225 225 }; 226 226 227 class While Stmt : public Statement {227 class WhileDoStmt : public Statement { 228 228 public: 229 229 Expression * condition; 230 230 Statement * body; 231 Statement * else_; 231 232 std::list<Statement *> initialization; 232 233 bool isDoWhile; 233 234 234 WhileStmt( Expression * condition, Statement * body, std::list<Statement *> & initialization, bool isDoWhile = false ); 235 WhileStmt( const WhileStmt & other ); 236 virtual ~WhileStmt(); 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 ); 237 WhileDoStmt( const WhileDoStmt & other ); 238 virtual ~WhileDoStmt(); 237 239 238 240 Expression * get_condition() { return condition; } … … 243 245 void set_isDoWhile( bool newValue ) { isDoWhile = newValue; } 244 246 245 virtual While Stmt * clone() const override { return new WhileStmt( *this ); }247 virtual WhileDoStmt * clone() const override { return new WhileDoStmt( *this ); } 246 248 virtual void accept( Visitor & v ) override { v.visit( this ); } 247 249 virtual void accept( Visitor & v ) const override { v.visit( this ); } … … 256 258 Expression * increment; 257 259 Statement * body; 258 259 ForStmt( std::list<Statement *> initialization, Expression * condition = nullptr, Expression * increment = nullptr, Statement * body = nullptr ); 260 Statement * else_; 261 262 ForStmt( std::list<Statement *> initialization, Expression * condition = nullptr, Expression * increment = nullptr, Statement * body = nullptr, Statement * else_ = nullptr ); 260 263 ForStmt( const ForStmt & other ); 261 264 virtual ~ForStmt();
Note: See TracChangeset
for help on using the changeset viewer.