OLD | NEW |
| (Empty) |
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 | |
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 #ifndef V8_AST_INL_H_ | |
29 #define V8_AST_INL_H_ | |
30 | |
31 #include "v8.h" | |
32 | |
33 #include "ast.h" | |
34 #include "scopes.h" | |
35 | |
36 namespace v8 { | |
37 namespace internal { | |
38 | |
39 | |
40 SwitchStatement::SwitchStatement(Isolate* isolate, | |
41 ZoneStringList* labels) | |
42 : BreakableStatement(isolate, labels, TARGET_FOR_ANONYMOUS), | |
43 tag_(NULL), cases_(NULL) { | |
44 } | |
45 | |
46 | |
47 Block::Block(Isolate* isolate, | |
48 ZoneStringList* labels, | |
49 int capacity, | |
50 bool is_initializer_block) | |
51 : BreakableStatement(isolate, labels, TARGET_FOR_NAMED_ONLY), | |
52 statements_(capacity), | |
53 is_initializer_block_(is_initializer_block), | |
54 block_scope_(NULL) { | |
55 } | |
56 | |
57 | |
58 BreakableStatement::BreakableStatement(Isolate* isolate, | |
59 ZoneStringList* labels, | |
60 Type type) | |
61 : labels_(labels), | |
62 type_(type), | |
63 entry_id_(GetNextId(isolate)), | |
64 exit_id_(GetNextId(isolate)) { | |
65 ASSERT(labels == NULL || labels->length() > 0); | |
66 } | |
67 | |
68 | |
69 IterationStatement::IterationStatement(Isolate* isolate, ZoneStringList* labels) | |
70 : BreakableStatement(isolate, labels, TARGET_FOR_ANONYMOUS), | |
71 body_(NULL), | |
72 continue_target_(), | |
73 osr_entry_id_(GetNextId(isolate)) { | |
74 } | |
75 | |
76 | |
77 DoWhileStatement::DoWhileStatement(Isolate* isolate, ZoneStringList* labels) | |
78 : IterationStatement(isolate, labels), | |
79 cond_(NULL), | |
80 condition_position_(-1), | |
81 continue_id_(GetNextId(isolate)), | |
82 back_edge_id_(GetNextId(isolate)) { | |
83 } | |
84 | |
85 | |
86 WhileStatement::WhileStatement(Isolate* isolate, ZoneStringList* labels) | |
87 : IterationStatement(isolate, labels), | |
88 cond_(NULL), | |
89 may_have_function_literal_(true), | |
90 body_id_(GetNextId(isolate)) { | |
91 } | |
92 | |
93 | |
94 ForStatement::ForStatement(Isolate* isolate, ZoneStringList* labels) | |
95 : IterationStatement(isolate, labels), | |
96 init_(NULL), | |
97 cond_(NULL), | |
98 next_(NULL), | |
99 may_have_function_literal_(true), | |
100 loop_variable_(NULL), | |
101 continue_id_(GetNextId(isolate)), | |
102 body_id_(GetNextId(isolate)) { | |
103 } | |
104 | |
105 | |
106 ForInStatement::ForInStatement(Isolate* isolate, ZoneStringList* labels) | |
107 : IterationStatement(isolate, labels), | |
108 each_(NULL), | |
109 enumerable_(NULL), | |
110 assignment_id_(GetNextId(isolate)) { | |
111 } | |
112 | |
113 | |
114 int FunctionLiteral::start_position() const { | |
115 return scope()->start_position(); | |
116 } | |
117 | |
118 | |
119 int FunctionLiteral::end_position() const { | |
120 return scope()->end_position(); | |
121 } | |
122 | |
123 | |
124 StrictModeFlag FunctionLiteral::strict_mode_flag() const { | |
125 return scope()->strict_mode_flag(); | |
126 } | |
127 | |
128 | |
129 } } // namespace v8::internal | |
130 | |
131 #endif // V8_AST_INL_H_ | |
OLD | NEW |