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-expression-rewriter.h" | 5 #include "src/ast/ast-expression-rewriter.h" |
6 #include "src/ast/ast.h" | 6 #include "src/ast/ast.h" |
7 #include "src/objects-inl.h" | 7 #include "src/objects-inl.h" |
8 | 8 |
9 namespace v8 { | 9 namespace v8 { |
10 namespace internal { | 10 namespace internal { |
(...skipping 169 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
180 | 180 |
181 | 181 |
182 void AstExpressionRewriter::VisitDebuggerStatement(DebuggerStatement* node) { | 182 void AstExpressionRewriter::VisitDebuggerStatement(DebuggerStatement* node) { |
183 NOTHING(); | 183 NOTHING(); |
184 } | 184 } |
185 | 185 |
186 | 186 |
187 void AstExpressionRewriter::VisitFunctionLiteral(FunctionLiteral* node) { | 187 void AstExpressionRewriter::VisitFunctionLiteral(FunctionLiteral* node) { |
188 REWRITE_THIS(node); | 188 REWRITE_THIS(node); |
189 VisitDeclarations(node->scope()->declarations()); | 189 VisitDeclarations(node->scope()->declarations()); |
| 190 Block* init_block = node->parameter_init_block(); |
| 191 if (init_block != nullptr) VisitBlock(init_block); |
190 ZoneList<Statement*>* body = node->body(); | 192 ZoneList<Statement*>* body = node->body(); |
191 if (body != nullptr) VisitStatements(body); | 193 if (body != nullptr) VisitStatements(body); |
192 } | 194 } |
193 | 195 |
194 | 196 |
195 void AstExpressionRewriter::VisitClassLiteral(ClassLiteral* node) { | 197 void AstExpressionRewriter::VisitClassLiteral(ClassLiteral* node) { |
196 REWRITE_THIS(node); | 198 REWRITE_THIS(node); |
197 // Not visiting `class_variable_proxy_`. | 199 // Not visiting `class_variable_proxy_`. |
198 if (node->extends() != nullptr) { | 200 if (node->extends() != nullptr) { |
199 AST_REWRITE_PROPERTY(Expression, node, extends); | 201 AST_REWRITE_PROPERTY(Expression, node, extends); |
(...skipping 61 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
261 | 263 |
262 void AstExpressionRewriter::VisitAssignment(Assignment* node) { | 264 void AstExpressionRewriter::VisitAssignment(Assignment* node) { |
263 REWRITE_THIS(node); | 265 REWRITE_THIS(node); |
264 AST_REWRITE_PROPERTY(Expression, node, target); | 266 AST_REWRITE_PROPERTY(Expression, node, target); |
265 AST_REWRITE_PROPERTY(Expression, node, value); | 267 AST_REWRITE_PROPERTY(Expression, node, value); |
266 } | 268 } |
267 | 269 |
268 | 270 |
269 void AstExpressionRewriter::VisitYield(Yield* node) { | 271 void AstExpressionRewriter::VisitYield(Yield* node) { |
270 REWRITE_THIS(node); | 272 REWRITE_THIS(node); |
271 AST_REWRITE_PROPERTY(Expression, node, generator_object); | |
272 AST_REWRITE_PROPERTY(Expression, node, expression); | 273 AST_REWRITE_PROPERTY(Expression, node, expression); |
273 } | 274 } |
274 | 275 |
275 | 276 |
276 void AstExpressionRewriter::VisitThrow(Throw* node) { | 277 void AstExpressionRewriter::VisitThrow(Throw* node) { |
277 REWRITE_THIS(node); | 278 REWRITE_THIS(node); |
278 AST_REWRITE_PROPERTY(Expression, node, exception); | 279 AST_REWRITE_PROPERTY(Expression, node, exception); |
279 } | 280 } |
280 | 281 |
281 | 282 |
(...skipping 88 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
370 | 371 |
371 | 372 |
372 void AstExpressionRewriter::VisitEmptyParentheses(EmptyParentheses* node) { | 373 void AstExpressionRewriter::VisitEmptyParentheses(EmptyParentheses* node) { |
373 NOTHING(); | 374 NOTHING(); |
374 } | 375 } |
375 | 376 |
376 void AstExpressionRewriter::VisitGetIterator(GetIterator* node) { | 377 void AstExpressionRewriter::VisitGetIterator(GetIterator* node) { |
377 AST_REWRITE_PROPERTY(Expression, node, iterable); | 378 AST_REWRITE_PROPERTY(Expression, node, iterable); |
378 } | 379 } |
379 | 380 |
| 381 void AstExpressionRewriter::VisitInternalVariable(InternalVariable* node) { |
| 382 NOTHING(); |
| 383 } |
| 384 |
380 void AstExpressionRewriter::VisitDoExpression(DoExpression* node) { | 385 void AstExpressionRewriter::VisitDoExpression(DoExpression* node) { |
381 REWRITE_THIS(node); | 386 REWRITE_THIS(node); |
382 AST_REWRITE_PROPERTY(Block, node, block); | 387 AST_REWRITE_PROPERTY(Block, node, block); |
383 AST_REWRITE_PROPERTY(VariableProxy, node, result); | 388 AST_REWRITE_PROPERTY(VariableProxy, node, result); |
384 } | 389 } |
385 | 390 |
386 | 391 |
387 void AstExpressionRewriter::VisitRewritableExpression( | 392 void AstExpressionRewriter::VisitRewritableExpression( |
388 RewritableExpression* node) { | 393 RewritableExpression* node) { |
389 REWRITE_THIS(node); | 394 REWRITE_THIS(node); |
390 AST_REWRITE(Expression, node->expression(), node->Rewrite(replacement)); | 395 AST_REWRITE(Expression, node->expression(), node->Rewrite(replacement)); |
391 } | 396 } |
392 | 397 |
393 | 398 |
394 } // namespace internal | 399 } // namespace internal |
395 } // namespace v8 | 400 } // namespace v8 |
OLD | NEW |