| 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 | 9 |
| 10 /** | 10 /** |
| (...skipping 329 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 340 nodes[i] = visitExpression(nodes[i]); | 340 nodes[i] = visitExpression(nodes[i]); |
| 341 } | 341 } |
| 342 } | 342 } |
| 343 | 343 |
| 344 Expression visitInvokeStatic(InvokeStatic node) { | 344 Expression visitInvokeStatic(InvokeStatic node) { |
| 345 _rewriteList(node.arguments); | 345 _rewriteList(node.arguments); |
| 346 return node; | 346 return node; |
| 347 } | 347 } |
| 348 | 348 |
| 349 Expression visitInvokeMethod(InvokeMethod node) { | 349 Expression visitInvokeMethod(InvokeMethod node) { |
| 350 _rewriteList(node.arguments); | 350 if (node.receiverIsNotNull) { |
| 351 node.receiver = visitExpression(node.receiver); | 351 _rewriteList(node.arguments); |
| 352 node.receiver = visitExpression(node.receiver); |
| 353 } else { |
| 354 // Impure expressions cannot be propagated across the method lookup, |
| 355 // because it throws when the receiver is null. |
| 356 inEmptyEnvironment(() { |
| 357 _rewriteList(node.arguments); |
| 358 }); |
| 359 node.receiver = visitExpression(node.receiver); |
| 360 } |
| 352 return node; | 361 return node; |
| 353 } | 362 } |
| 354 | 363 |
| 355 Expression visitInvokeMethodDirectly(InvokeMethodDirectly node) { | 364 Expression visitInvokeMethodDirectly(InvokeMethodDirectly node) { |
| 356 _rewriteList(node.arguments); | 365 _rewriteList(node.arguments); |
| 357 node.receiver = visitExpression(node.receiver); | 366 node.receiver = visitExpression(node.receiver); |
| 358 return node; | 367 return node; |
| 359 } | 368 } |
| 360 | 369 |
| 361 Expression visitInvokeConstructor(InvokeConstructor node) { | 370 Expression visitInvokeConstructor(InvokeConstructor node) { |
| (...skipping 541 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 903 } | 912 } |
| 904 | 913 |
| 905 /// Result of combining two expressions that do not affect reference counting. | 914 /// Result of combining two expressions that do not affect reference counting. |
| 906 class GenericCombinedExpressions implements CombinedExpressions { | 915 class GenericCombinedExpressions implements CombinedExpressions { |
| 907 Expression combined; | 916 Expression combined; |
| 908 | 917 |
| 909 GenericCombinedExpressions(this.combined); | 918 GenericCombinedExpressions(this.combined); |
| 910 | 919 |
| 911 void uncombine() {} | 920 void uncombine() {} |
| 912 } | 921 } |
| OLD | NEW |