OLD | NEW |
1 // Copyright (c) 2015, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2015, 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 import 'optimization.dart' show Pass; | 5 import 'optimization.dart' show Pass; |
6 import '../tree_ir_nodes.dart'; | 6 import '../tree_ir_nodes.dart'; |
7 | 7 |
8 /// Pulls assignment expressions to the top of the function body so they can be | 8 /// Pulls assignment expressions to the top of the function body so they can be |
9 /// translated into declaration-site variable initializaters. | 9 /// translated into declaration-site variable initializaters. |
10 /// | 10 /// |
(...skipping 229 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
240 entry.key = visitExpression(entry.key); | 240 entry.key = visitExpression(entry.key); |
241 if (seenImpure) return node; | 241 if (seenImpure) return node; |
242 entry.value = visitExpression(entry.value); | 242 entry.value = visitExpression(entry.value); |
243 if (seenImpure) return node; | 243 if (seenImpure) return node; |
244 } | 244 } |
245 if (node.type != null) seenImpure = true; // Type casts can throw. | 245 if (node.type != null) seenImpure = true; // Type casts can throw. |
246 return node; | 246 return node; |
247 } | 247 } |
248 | 248 |
249 Expression visitTypeOperator(TypeOperator node) { | 249 Expression visitTypeOperator(TypeOperator node) { |
250 node.receiver = visitExpression(node.receiver); | 250 node.value = visitExpression(node.value); |
| 251 if (seenImpure) return node; |
| 252 rewriteList(node.typeArguments); |
251 if (!node.isTypeTest) seenImpure = true; // Type cast can throw. | 253 if (!node.isTypeTest) seenImpure = true; // Type cast can throw. |
252 return node; | 254 return node; |
253 } | 255 } |
254 | 256 |
255 void visitInnerFunction(FunctionDefinition node) { | 257 void visitInnerFunction(FunctionDefinition node) { |
256 node.body = new BodyRewriter().rewriteBody(node.parameters, node.body); | 258 node.body = new BodyRewriter().rewriteBody(node.parameters, node.body); |
257 } | 259 } |
258 | 260 |
259 Expression visitFunctionExpression(FunctionExpression node) { | 261 Expression visitFunctionExpression(FunctionExpression node) { |
260 visitInnerFunction(node.definition); | 262 visitInnerFunction(node.definition); |
(...skipping 63 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
324 | 326 |
325 Expression visitVariableUse(VariableUse node) { | 327 Expression visitVariableUse(VariableUse node) { |
326 return node; | 328 return node; |
327 } | 329 } |
328 | 330 |
329 Expression visitCreateInvocationMirror(CreateInvocationMirror node) { | 331 Expression visitCreateInvocationMirror(CreateInvocationMirror node) { |
330 rewriteList(node.arguments); | 332 rewriteList(node.arguments); |
331 return node; | 333 return node; |
332 } | 334 } |
333 } | 335 } |
OLD | NEW |