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 20 matching lines...) Expand all Loading... |
31 #include "scopes.h" | 31 #include "scopes.h" |
32 #include "string-stream.h" | 32 #include "string-stream.h" |
33 | 33 |
34 namespace v8 { namespace internal { | 34 namespace v8 { namespace internal { |
35 | 35 |
36 | 36 |
37 VariableProxySentinel VariableProxySentinel::this_proxy_(true); | 37 VariableProxySentinel VariableProxySentinel::this_proxy_(true); |
38 VariableProxySentinel VariableProxySentinel::identifier_proxy_(false); | 38 VariableProxySentinel VariableProxySentinel::identifier_proxy_(false); |
39 ValidLeftHandSideSentinel ValidLeftHandSideSentinel::instance_; | 39 ValidLeftHandSideSentinel ValidLeftHandSideSentinel::instance_; |
40 Property Property::this_property_(VariableProxySentinel::this_proxy(), NULL, 0); | 40 Property Property::this_property_(VariableProxySentinel::this_proxy(), NULL, 0); |
41 Call Call::sentinel_(NULL, NULL, false, 0); | 41 Call Call::sentinel_(NULL, NULL, 0); |
| 42 CallEval CallEval::sentinel_(NULL, NULL, 0); |
42 | 43 |
43 | 44 |
44 // ---------------------------------------------------------------------------- | 45 // ---------------------------------------------------------------------------- |
45 // All the Accept member functions for each syntax tree node type. | 46 // All the Accept member functions for each syntax tree node type. |
46 | 47 |
47 #define DECL_ACCEPT(type) \ | 48 #define DECL_ACCEPT(type) \ |
48 void type::Accept(Visitor* v) { \ | 49 void type::Accept(AstVisitor* v) { \ |
49 if (v->CheckStackOverflow()) return; \ | 50 if (v->CheckStackOverflow()) return; \ |
50 v->Visit##type(this); \ | 51 v->Visit##type(this); \ |
51 } | 52 } |
52 NODE_LIST(DECL_ACCEPT) | 53 NODE_LIST(DECL_ACCEPT) |
53 #undef DECL_ACCEPT | 54 #undef DECL_ACCEPT |
54 | 55 |
55 | 56 |
56 // ---------------------------------------------------------------------------- | 57 // ---------------------------------------------------------------------------- |
57 // Implementation of other node functionality. | 58 // Implementation of other node functionality. |
58 | 59 |
(...skipping 92 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
151 // Add the label to the collector, but discard duplicates. | 152 // Add the label to the collector, but discard duplicates. |
152 int length = labels_->length(); | 153 int length = labels_->length(); |
153 for (int i = 0; i < length; i++) { | 154 for (int i = 0; i < length; i++) { |
154 if (labels_->at(i) == label) return; | 155 if (labels_->at(i) == label) return; |
155 } | 156 } |
156 labels_->Add(label); | 157 labels_->Add(label); |
157 } | 158 } |
158 | 159 |
159 | 160 |
160 // ---------------------------------------------------------------------------- | 161 // ---------------------------------------------------------------------------- |
161 // Implementation of Visitor | 162 // Implementation of AstVisitor |
162 | 163 |
163 | 164 |
164 void Visitor::VisitStatements(ZoneList<Statement*>* statements) { | 165 void AstVisitor::VisitStatements(ZoneList<Statement*>* statements) { |
165 for (int i = 0; i < statements->length(); i++) { | 166 for (int i = 0; i < statements->length(); i++) { |
166 Visit(statements->at(i)); | 167 Visit(statements->at(i)); |
167 } | 168 } |
168 } | 169 } |
169 | 170 |
170 | 171 |
171 void Visitor::VisitExpressions(ZoneList<Expression*>* expressions) { | 172 void AstVisitor::VisitExpressions(ZoneList<Expression*>* expressions) { |
172 for (int i = 0; i < expressions->length(); i++) { | 173 for (int i = 0; i < expressions->length(); i++) { |
173 // The variable statement visiting code may pass NULL expressions | 174 // The variable statement visiting code may pass NULL expressions |
174 // to this code. Maybe this should be handled by introducing an | 175 // to this code. Maybe this should be handled by introducing an |
175 // undefined expression or literal? Revisit this code if this | 176 // undefined expression or literal? Revisit this code if this |
176 // changes | 177 // changes |
177 Expression* expression = expressions->at(i); | 178 Expression* expression = expressions->at(i); |
178 if (expression != NULL) Visit(expression); | 179 if (expression != NULL) Visit(expression); |
179 } | 180 } |
180 } | 181 } |
181 | 182 |
(...skipping 192 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
374 | 375 |
375 | 376 |
376 SmartPointer<const char> RegExpTree::ToString() { | 377 SmartPointer<const char> RegExpTree::ToString() { |
377 RegExpUnparser unparser; | 378 RegExpUnparser unparser; |
378 Accept(&unparser, NULL); | 379 Accept(&unparser, NULL); |
379 return unparser.ToString(); | 380 return unparser.ToString(); |
380 } | 381 } |
381 | 382 |
382 | 383 |
383 } } // namespace v8::internal | 384 } } // namespace v8::internal |
OLD | NEW |