1 // Copyright 2011 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
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.
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.
40 SwitchStatement::SwitchStatement(Isolate* isolate,
41 ZoneStringList* labels)
42 : BreakableStatement(isolate, labels, TARGET_FOR_ANONYMOUS),
43 tag_(NULL), cases_(NULL) {
47 Block::Block(Isolate* isolate,
48 ZoneStringList* labels,
50 bool is_initializer_block)
51 : BreakableStatement(isolate, labels, TARGET_FOR_NAMED_ONLY),
52 statements_(capacity),
53 is_initializer_block_(is_initializer_block),
58 BreakableStatement::BreakableStatement(Isolate* isolate,
59 ZoneStringList* labels,
63 entry_id_(GetNextId(isolate)),
64 exit_id_(GetNextId(isolate)) {
65 ASSERT(labels == NULL || labels->length() > 0);
69 IterationStatement::IterationStatement(Isolate* isolate, ZoneStringList* labels)
70 : BreakableStatement(isolate, labels, TARGET_FOR_ANONYMOUS),
73 osr_entry_id_(GetNextId(isolate)) {
77 DoWhileStatement::DoWhileStatement(Isolate* isolate, ZoneStringList* labels)
78 : IterationStatement(isolate, labels),
80 condition_position_(-1),
81 continue_id_(GetNextId(isolate)),
82 back_edge_id_(GetNextId(isolate)) {
86 WhileStatement::WhileStatement(Isolate* isolate, ZoneStringList* labels)
87 : IterationStatement(isolate, labels),
89 may_have_function_literal_(true),
90 body_id_(GetNextId(isolate)) {
94 ForStatement::ForStatement(Isolate* isolate, ZoneStringList* labels)
95 : IterationStatement(isolate, labels),
99 may_have_function_literal_(true),
100 loop_variable_(NULL),
101 continue_id_(GetNextId(isolate)),
102 body_id_(GetNextId(isolate)) {
106 ForInStatement::ForInStatement(Isolate* isolate, ZoneStringList* labels)
107 : IterationStatement(isolate, labels),
110 assignment_id_(GetNextId(isolate)) {
114 int FunctionLiteral::start_position() const {
115 return scope()->start_position();
119 int FunctionLiteral::end_position() const {
120 return scope()->end_position();
124 StrictModeFlag FunctionLiteral::strict_mode_flag() const {
125 return scope()->strict_mode_flag();
129 bool FunctionLiteral::qml_mode() const {
130 return scope()->is_qml_mode();
134 } } // namespace v8::internal
136 #endif // V8_AST_INL_H_