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.value = visitExpression(node.value); | 250 node.receiver = visitExpression(node.receiver); |
251 if (seenImpure) return node; | |
252 rewriteList(node.typeArguments); | |
253 if (!node.isTypeTest) seenImpure = true; // Type cast can throw. | 251 if (!node.isTypeTest) seenImpure = true; // Type cast can throw. |
254 return node; | 252 return node; |
255 } | 253 } |
256 | 254 |
257 void visitInnerFunction(FunctionDefinition node) { | 255 void visitInnerFunction(FunctionDefinition node) { |
258 node.body = new BodyRewriter().rewriteBody(node.parameters, node.body); | 256 node.body = new BodyRewriter().rewriteBody(node.parameters, node.body); |
259 } | 257 } |
260 | 258 |
261 Expression visitFunctionExpression(FunctionExpression node) { | 259 Expression visitFunctionExpression(FunctionExpression node) { |
262 visitInnerFunction(node.definition); | 260 visitInnerFunction(node.definition); |
(...skipping 63 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
326 | 324 |
327 Expression visitVariableUse(VariableUse node) { | 325 Expression visitVariableUse(VariableUse node) { |
328 return node; | 326 return node; |
329 } | 327 } |
330 | 328 |
331 Expression visitCreateInvocationMirror(CreateInvocationMirror node) { | 329 Expression visitCreateInvocationMirror(CreateInvocationMirror node) { |
332 rewriteList(node.arguments); | 330 rewriteList(node.arguments); |
333 return node; | 331 return node; |
334 } | 332 } |
335 } | 333 } |
OLD | NEW |