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-literal-reindexer.h" | 5 #include "src/ast/ast-literal-reindexer.h" |
6 | 6 |
7 #include "src/ast/ast.h" | 7 #include "src/ast/ast.h" |
8 #include "src/ast/scopes.h" | 8 #include "src/ast/scopes.h" |
9 | 9 |
10 namespace v8 { | 10 namespace v8 { |
(...skipping 231 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
242 } | 242 } |
243 | 243 |
244 | 244 |
245 void AstLiteralReindexer::VisitClassLiteral(ClassLiteral* node) { | 245 void AstLiteralReindexer::VisitClassLiteral(ClassLiteral* node) { |
246 if (node->extends()) Visit(node->extends()); | 246 if (node->extends()) Visit(node->extends()); |
247 if (node->constructor()) Visit(node->constructor()); | 247 if (node->constructor()) Visit(node->constructor()); |
248 if (node->class_variable_proxy()) { | 248 if (node->class_variable_proxy()) { |
249 VisitVariableProxy(node->class_variable_proxy()); | 249 VisitVariableProxy(node->class_variable_proxy()); |
250 } | 250 } |
251 for (int i = 0; i < node->properties()->length(); i++) { | 251 for (int i = 0; i < node->properties()->length(); i++) { |
252 VisitObjectLiteralProperty(node->properties()->at(i)); | 252 VisitLiteralProperty(node->properties()->at(i)); |
253 } | 253 } |
254 } | 254 } |
255 | 255 |
256 | |
257 void AstLiteralReindexer::VisitObjectLiteral(ObjectLiteral* node) { | 256 void AstLiteralReindexer::VisitObjectLiteral(ObjectLiteral* node) { |
258 UpdateIndex(node); | 257 UpdateIndex(node); |
259 for (int i = 0; i < node->properties()->length(); i++) { | 258 for (int i = 0; i < node->properties()->length(); i++) { |
260 VisitObjectLiteralProperty(node->properties()->at(i)); | 259 VisitLiteralProperty(node->properties()->at(i)); |
261 } | 260 } |
262 } | 261 } |
263 | 262 |
264 | 263 void AstLiteralReindexer::VisitLiteralProperty(LiteralProperty* node) { |
265 void AstLiteralReindexer::VisitObjectLiteralProperty( | |
266 ObjectLiteralProperty* node) { | |
267 Visit(node->key()); | 264 Visit(node->key()); |
268 Visit(node->value()); | 265 Visit(node->value()); |
269 } | 266 } |
270 | 267 |
271 | 268 |
272 void AstLiteralReindexer::VisitArrayLiteral(ArrayLiteral* node) { | 269 void AstLiteralReindexer::VisitArrayLiteral(ArrayLiteral* node) { |
273 UpdateIndex(node); | 270 UpdateIndex(node); |
274 for (int i = 0; i < node->values()->length(); i++) { | 271 for (int i = 0; i < node->values()->length(); i++) { |
275 Visit(node->values()->at(i)); | 272 Visit(node->values()->at(i)); |
276 } | 273 } |
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
312 } | 309 } |
313 | 310 |
314 | 311 |
315 void AstLiteralReindexer::VisitFunctionLiteral(FunctionLiteral* node) { | 312 void AstLiteralReindexer::VisitFunctionLiteral(FunctionLiteral* node) { |
316 // We don't recurse into the declarations or body of the function literal: | 313 // We don't recurse into the declarations or body of the function literal: |
317 } | 314 } |
318 | 315 |
319 void AstLiteralReindexer::Reindex(Expression* pattern) { Visit(pattern); } | 316 void AstLiteralReindexer::Reindex(Expression* pattern) { Visit(pattern); } |
320 } // namespace internal | 317 } // namespace internal |
321 } // namespace v8 | 318 } // namespace v8 |
OLD | NEW |