OLD | NEW |
1 // Copyright (c) 2014, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2014, the Dart project authors. Please see the AUTHORS file |
2 // for details. All rights reserved. Use of this source code is governed by a | 2 // for details. All rights reserved. Use of this source code is governed by a |
3 // BSD-style license that can be found in the LICENSE file. | 3 // BSD-style license that can be found in the LICENSE file. |
4 | 4 |
5 library tree_ir.optimization.statement_rewriter; | 5 library tree_ir.optimization.statement_rewriter; |
6 | 6 |
7 import 'optimization.dart' show Pass; | 7 import 'optimization.dart' show Pass; |
8 import '../tree_ir_nodes.dart'; | 8 import '../tree_ir_nodes.dart'; |
9 import '../../io/source_information.dart'; | 9 import '../../io/source_information.dart'; |
10 import '../../elements/elements.dart'; | 10 import '../../elements/elements.dart'; |
(...skipping 485 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
496 // Impure expressions cannot be propagated across the method lookup, | 496 // Impure expressions cannot be propagated across the method lookup, |
497 // because it throws when the receiver is null. | 497 // because it throws when the receiver is null. |
498 inEmptyEnvironment(() { | 498 inEmptyEnvironment(() { |
499 _rewriteList(node.arguments); | 499 _rewriteList(node.arguments); |
500 }); | 500 }); |
501 node.receiver = visitExpression(node.receiver); | 501 node.receiver = visitExpression(node.receiver); |
502 } | 502 } |
503 return node; | 503 return node; |
504 } | 504 } |
505 | 505 |
| 506 Expression visitOneShotInterceptor(OneShotInterceptor node) { |
| 507 _rewriteList(node.arguments); |
| 508 return node; |
| 509 } |
| 510 |
506 Expression visitApplyBuiltinMethod(ApplyBuiltinMethod node) { | 511 Expression visitApplyBuiltinMethod(ApplyBuiltinMethod node) { |
507 if (node.receiverIsNotNull) { | 512 if (node.receiverIsNotNull) { |
508 _rewriteList(node.arguments); | 513 _rewriteList(node.arguments); |
509 node.receiver = visitExpression(node.receiver); | 514 node.receiver = visitExpression(node.receiver); |
510 } else { | 515 } else { |
511 // Impure expressions cannot be propagated across the method lookup, | 516 // Impure expressions cannot be propagated across the method lookup, |
512 // because it throws when the receiver is null. | 517 // because it throws when the receiver is null. |
513 inEmptyEnvironment(() { | 518 inEmptyEnvironment(() { |
514 _rewriteList(node.arguments); | 519 _rewriteList(node.arguments); |
515 }); | 520 }); |
(...skipping 769 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1285 VariableUseCallback callback; | 1290 VariableUseCallback callback; |
1286 | 1291 |
1287 VariableUseVisitor(this.callback); | 1292 VariableUseVisitor(this.callback); |
1288 | 1293 |
1289 visitVariableUse(VariableUse use) => callback(use); | 1294 visitVariableUse(VariableUse use) => callback(use); |
1290 | 1295 |
1291 static void visit(Expression node, VariableUseCallback callback) { | 1296 static void visit(Expression node, VariableUseCallback callback) { |
1292 new VariableUseVisitor(callback).visitExpression(node); | 1297 new VariableUseVisitor(callback).visitExpression(node); |
1293 } | 1298 } |
1294 } | 1299 } |
OLD | NEW |