blob: 2b5d7c472bd2affa0954813a27f0016479a365ce [file] [log] [blame]
Kristian Monsen25f61362010-05-21 11:50:48 +01001// 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
32namespace v8 {
33namespace internal {
34
35BreakableStatement::BreakableStatement(ZoneStringList* labels, Type type)
36 : labels_(labels), type_(type) {
37 ASSERT(labels == NULL || labels->length() > 0);
38}
39
40
41SwitchStatement::SwitchStatement(ZoneStringList* labels)
42 : BreakableStatement(labels, TARGET_FOR_ANONYMOUS),
43 tag_(NULL), cases_(NULL) {
44}
45
46
47IterationStatement::IterationStatement(ZoneStringList* labels)
48 : BreakableStatement(labels, TARGET_FOR_ANONYMOUS), body_(NULL) {
49}
50
51
52Block::Block(ZoneStringList* labels, int capacity, bool is_initializer_block)
53 : BreakableStatement(labels, TARGET_FOR_NAMED_ONLY),
54 statements_(capacity),
55 is_initializer_block_(is_initializer_block) {
56}
57
58
59ForStatement::ForStatement(ZoneStringList* labels)
60 : IterationStatement(labels),
61 init_(NULL),
62 cond_(NULL),
63 next_(NULL),
64 may_have_function_literal_(true),
65 loop_variable_(NULL),
66 peel_this_loop_(false) {
67}
68
69
70ForInStatement::ForInStatement(ZoneStringList* labels)
71 : IterationStatement(labels), each_(NULL), enumerable_(NULL) {
72}
73
74
75DoWhileStatement::DoWhileStatement(ZoneStringList* labels)
76 : IterationStatement(labels), cond_(NULL), condition_position_(-1) {
77}
78
79} } // namespace v8::internal