OLD | NEW |
1 // Copyright 2006-2008 the V8 project authors. All rights reserved. | 1 // Copyright 2006-2008 the V8 project authors. All rights reserved. |
2 // Redistribution and use in source and binary forms, with or without | 2 // Redistribution and use in source and binary forms, with or without |
3 // modification, are permitted provided that the following conditions are | 3 // modification, are permitted provided that the following conditions are |
4 // met: | 4 // met: |
5 // | 5 // |
6 // * Redistributions of source code must retain the above copyright | 6 // * Redistributions of source code must retain the above copyright |
7 // notice, this list of conditions and the following disclaimer. | 7 // notice, this list of conditions and the following disclaimer. |
8 // * Redistributions in binary form must reproduce the above | 8 // * Redistributions in binary form must reproduce the above |
9 // copyright notice, this list of conditions and the following | 9 // copyright notice, this list of conditions and the following |
10 // disclaimer in the documentation and/or other materials provided | 10 // disclaimer in the documentation and/or other materials provided |
(...skipping 304 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
315 | 315 |
316 private: | 316 private: |
317 Statement* body_; | 317 Statement* body_; |
318 BreakTarget continue_target_; | 318 BreakTarget continue_target_; |
319 }; | 319 }; |
320 | 320 |
321 | 321 |
322 class DoWhileStatement: public IterationStatement { | 322 class DoWhileStatement: public IterationStatement { |
323 public: | 323 public: |
324 explicit DoWhileStatement(ZoneStringList* labels) | 324 explicit DoWhileStatement(ZoneStringList* labels) |
325 : IterationStatement(labels), cond_(NULL) { | 325 : IterationStatement(labels), cond_(NULL), condition_position_(-1) { |
326 } | 326 } |
327 | 327 |
328 void Initialize(Expression* cond, Statement* body) { | 328 void Initialize(Expression* cond, Statement* body) { |
329 IterationStatement::Initialize(body); | 329 IterationStatement::Initialize(body); |
330 cond_ = cond; | 330 cond_ = cond; |
331 } | 331 } |
332 | 332 |
333 virtual void Accept(AstVisitor* v); | 333 virtual void Accept(AstVisitor* v); |
334 | 334 |
335 Expression* cond() const { return cond_; } | 335 Expression* cond() const { return cond_; } |
336 | 336 |
| 337 // Position where condition expression starts. We need it to make |
| 338 // the loop's condition a breakable location. |
| 339 int condition_position() { return condition_position_; } |
| 340 void set_condition_position(int pos) { condition_position_ = pos; } |
| 341 |
337 private: | 342 private: |
338 Expression* cond_; | 343 Expression* cond_; |
| 344 int condition_position_; |
339 }; | 345 }; |
340 | 346 |
341 | 347 |
342 class WhileStatement: public IterationStatement { | 348 class WhileStatement: public IterationStatement { |
343 public: | 349 public: |
344 explicit WhileStatement(ZoneStringList* labels) | 350 explicit WhileStatement(ZoneStringList* labels) |
345 : IterationStatement(labels), | 351 : IterationStatement(labels), |
346 cond_(NULL), | 352 cond_(NULL), |
347 may_have_function_literal_(true) { | 353 may_have_function_literal_(true) { |
348 } | 354 } |
(...skipping 1425 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1774 #undef DEF_VISIT | 1780 #undef DEF_VISIT |
1775 | 1781 |
1776 private: | 1782 private: |
1777 bool stack_overflow_; | 1783 bool stack_overflow_; |
1778 }; | 1784 }; |
1779 | 1785 |
1780 | 1786 |
1781 } } // namespace v8::internal | 1787 } } // namespace v8::internal |
1782 | 1788 |
1783 #endif // V8_AST_H_ | 1789 #endif // V8_AST_H_ |
OLD | NEW |