OLD | NEW |
1 // Copyright 2015 the V8 project authors. All rights reserved. | 1 // Copyright 2015 the V8 project authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #include "src/ast/ast.h" | 5 #include "src/ast/ast.h" |
6 #include "src/ast/ast-expression-rewriter.h" | 6 #include "src/ast/ast-expression-rewriter.h" |
7 | 7 |
8 namespace v8 { | 8 namespace v8 { |
9 namespace internal { | 9 namespace internal { |
10 | 10 |
(...skipping 183 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
194 | 194 |
195 void AstExpressionRewriter::VisitClassLiteral(ClassLiteral* node) { | 195 void AstExpressionRewriter::VisitClassLiteral(ClassLiteral* node) { |
196 REWRITE_THIS(node); | 196 REWRITE_THIS(node); |
197 // Not visiting `class_variable_proxy_`. | 197 // Not visiting `class_variable_proxy_`. |
198 if (node->extends() != nullptr) { | 198 if (node->extends() != nullptr) { |
199 AST_REWRITE_PROPERTY(Expression, node, extends); | 199 AST_REWRITE_PROPERTY(Expression, node, extends); |
200 } | 200 } |
201 AST_REWRITE_PROPERTY(FunctionLiteral, node, constructor); | 201 AST_REWRITE_PROPERTY(FunctionLiteral, node, constructor); |
202 ZoneList<typename ClassLiteral::Property*>* properties = node->properties(); | 202 ZoneList<typename ClassLiteral::Property*>* properties = node->properties(); |
203 for (int i = 0; i < properties->length(); i++) { | 203 for (int i = 0; i < properties->length(); i++) { |
204 VisitObjectLiteralProperty(properties->at(i)); | 204 VisitLiteralProperty(properties->at(i)); |
205 } | 205 } |
206 } | 206 } |
207 | 207 |
208 | |
209 void AstExpressionRewriter::VisitNativeFunctionLiteral( | 208 void AstExpressionRewriter::VisitNativeFunctionLiteral( |
210 NativeFunctionLiteral* node) { | 209 NativeFunctionLiteral* node) { |
211 REWRITE_THIS(node); | 210 REWRITE_THIS(node); |
212 NOTHING(); | 211 NOTHING(); |
213 } | 212 } |
214 | 213 |
215 | 214 |
216 void AstExpressionRewriter::VisitConditional(Conditional* node) { | 215 void AstExpressionRewriter::VisitConditional(Conditional* node) { |
217 REWRITE_THIS(node); | 216 REWRITE_THIS(node); |
218 AST_REWRITE_PROPERTY(Expression, node, condition); | 217 AST_REWRITE_PROPERTY(Expression, node, condition); |
(...skipping 17 matching lines...) Expand all Loading... |
236 void AstExpressionRewriter::VisitRegExpLiteral(RegExpLiteral* node) { | 235 void AstExpressionRewriter::VisitRegExpLiteral(RegExpLiteral* node) { |
237 REWRITE_THIS(node); | 236 REWRITE_THIS(node); |
238 NOTHING(); | 237 NOTHING(); |
239 } | 238 } |
240 | 239 |
241 | 240 |
242 void AstExpressionRewriter::VisitObjectLiteral(ObjectLiteral* node) { | 241 void AstExpressionRewriter::VisitObjectLiteral(ObjectLiteral* node) { |
243 REWRITE_THIS(node); | 242 REWRITE_THIS(node); |
244 ZoneList<typename ObjectLiteral::Property*>* properties = node->properties(); | 243 ZoneList<typename ObjectLiteral::Property*>* properties = node->properties(); |
245 for (int i = 0; i < properties->length(); i++) { | 244 for (int i = 0; i < properties->length(); i++) { |
246 VisitObjectLiteralProperty(properties->at(i)); | 245 VisitLiteralProperty(properties->at(i)); |
247 } | 246 } |
248 } | 247 } |
249 | 248 |
250 | 249 void AstExpressionRewriter::VisitLiteralProperty(LiteralProperty* property) { |
251 void AstExpressionRewriter::VisitObjectLiteralProperty( | |
252 ObjectLiteralProperty* property) { | |
253 if (property == nullptr) return; | 250 if (property == nullptr) return; |
254 AST_REWRITE_PROPERTY(Expression, property, key); | 251 AST_REWRITE_PROPERTY(Expression, property, key); |
255 AST_REWRITE_PROPERTY(Expression, property, value); | 252 AST_REWRITE_PROPERTY(Expression, property, value); |
256 } | 253 } |
257 | 254 |
258 | 255 |
259 void AstExpressionRewriter::VisitArrayLiteral(ArrayLiteral* node) { | 256 void AstExpressionRewriter::VisitArrayLiteral(ArrayLiteral* node) { |
260 REWRITE_THIS(node); | 257 REWRITE_THIS(node); |
261 VisitExpressions(node->values()); | 258 VisitExpressions(node->values()); |
262 } | 259 } |
(...skipping 123 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
386 | 383 |
387 void AstExpressionRewriter::VisitRewritableExpression( | 384 void AstExpressionRewriter::VisitRewritableExpression( |
388 RewritableExpression* node) { | 385 RewritableExpression* node) { |
389 REWRITE_THIS(node); | 386 REWRITE_THIS(node); |
390 AST_REWRITE(Expression, node->expression(), node->Rewrite(replacement)); | 387 AST_REWRITE(Expression, node->expression(), node->Rewrite(replacement)); |
391 } | 388 } |
392 | 389 |
393 | 390 |
394 } // namespace internal | 391 } // namespace internal |
395 } // namespace v8 | 392 } // namespace v8 |
OLD | NEW |