vegorov@chromium.org | dff694e | 2010-05-17 09:10:26 +0000 | [diff] [blame] | 1 | // Copyright 2010 the V8 project authors. All rights reserved. |
| 2 | // Redistribution and use in source and binary forms, with or without |
| 3 | // modification, are permitted provided that the following conditions are |
| 4 | // met: |
| 5 | // |
| 6 | // * Redistributions of source code must retain the above copyright |
| 7 | // notice, this list of conditions and the following disclaimer. |
| 8 | // * Redistributions in binary form must reproduce the above |
| 9 | // copyright notice, this list of conditions and the following |
| 10 | // disclaimer in the documentation and/or other materials provided |
| 11 | // with the distribution. |
| 12 | // * Neither the name of Google Inc. nor the names of its |
| 13 | // contributors may be used to endorse or promote products derived |
| 14 | // from this software without specific prior written permission. |
| 15 | // |
| 16 | // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS |
| 17 | // "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT |
| 18 | // LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR |
| 19 | // A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT |
| 20 | // OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, |
| 21 | // SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT |
| 22 | // LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, |
| 23 | // DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY |
| 24 | // THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT |
| 25 | // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE |
| 26 | // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
| 27 | |
| 28 | #include "v8.h" |
| 29 | |
| 30 | #include "ast.h" |
| 31 | |
| 32 | namespace v8 { |
| 33 | namespace internal { |
| 34 | |
| 35 | BreakableStatement::BreakableStatement(ZoneStringList* labels, Type type) |
| 36 | : labels_(labels), type_(type) { |
| 37 | ASSERT(labels == NULL || labels->length() > 0); |
| 38 | } |
| 39 | |
| 40 | |
| 41 | SwitchStatement::SwitchStatement(ZoneStringList* labels) |
| 42 | : BreakableStatement(labels, TARGET_FOR_ANONYMOUS), |
| 43 | tag_(NULL), cases_(NULL) { |
| 44 | } |
| 45 | |
| 46 | |
| 47 | IterationStatement::IterationStatement(ZoneStringList* labels) |
fschneider@chromium.org | 40b9da3 | 2010-06-28 11:29:21 +0000 | [diff] [blame] | 48 | : BreakableStatement(labels, TARGET_FOR_ANONYMOUS), |
| 49 | body_(NULL), |
| 50 | continue_target_(JumpTarget::BIDIRECTIONAL) { |
vegorov@chromium.org | dff694e | 2010-05-17 09:10:26 +0000 | [diff] [blame] | 51 | } |
| 52 | |
| 53 | |
| 54 | Block::Block(ZoneStringList* labels, int capacity, bool is_initializer_block) |
| 55 | : BreakableStatement(labels, TARGET_FOR_NAMED_ONLY), |
| 56 | statements_(capacity), |
| 57 | is_initializer_block_(is_initializer_block) { |
| 58 | } |
| 59 | |
| 60 | |
| 61 | ForStatement::ForStatement(ZoneStringList* labels) |
| 62 | : IterationStatement(labels), |
| 63 | init_(NULL), |
| 64 | cond_(NULL), |
| 65 | next_(NULL), |
| 66 | may_have_function_literal_(true), |
ricow@chromium.org | 65fae84 | 2010-08-25 15:26:24 +0000 | [diff] [blame] | 67 | loop_variable_(NULL) { |
vegorov@chromium.org | dff694e | 2010-05-17 09:10:26 +0000 | [diff] [blame] | 68 | } |
| 69 | |
| 70 | |
| 71 | ForInStatement::ForInStatement(ZoneStringList* labels) |
| 72 | : IterationStatement(labels), each_(NULL), enumerable_(NULL) { |
| 73 | } |
| 74 | |
| 75 | |
| 76 | DoWhileStatement::DoWhileStatement(ZoneStringList* labels) |
| 77 | : IterationStatement(labels), cond_(NULL), condition_position_(-1) { |
| 78 | } |
| 79 | |
| 80 | } } // namespace v8::internal |