| OLD | NEW |
| 1 // Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2013, 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 inferrer_visitor; | 5 library inferrer_visitor; |
| 6 | 6 |
| 7 import 'dart:collection' show IterableMixin; | 7 import 'dart:collection' show IterableMixin; |
| 8 | 8 |
| 9 import '../common.dart'; | 9 import '../common.dart'; |
| 10 import '../compiler.dart' show Compiler; | 10 import '../compiler.dart' show Compiler; |
| (...skipping 450 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 461 local, | 461 local, |
| 462 types.allocatePhi( | 462 types.allocatePhi( |
| 463 locals.block, local, types.narrowNotNull(currentType)), | 463 locals.block, local, types.narrowNotNull(currentType)), |
| 464 type); | 464 type); |
| 465 } | 465 } |
| 466 locals[local] = type; | 466 locals[local] = type; |
| 467 if (currentType != type) { | 467 if (currentType != type) { |
| 468 inferrer.recordLocalUpdate(local, type); | 468 inferrer.recordLocalUpdate(local, type); |
| 469 } | 469 } |
| 470 } | 470 } |
| 471 |
| 471 if (capturedAndBoxed.containsKey(local)) { | 472 if (capturedAndBoxed.containsKey(local)) { |
| 472 inferrer.recordTypeOfNonFinalField(node, capturedAndBoxed[local], type); | 473 inferrer.recordTypeOfNonFinalField(node, capturedAndBoxed[local], type); |
| 473 } else if (inTryBlock) { | 474 } else if (inTryBlock) { |
| 474 // We don't know if an assignment in a try block | 475 // We don't know if an assignment in a try block |
| 475 // will be executed, so all assigments in that block are | 476 // will be executed, so all assigments in that block are |
| 476 // potential types after we have left it. We update the parent | 477 // potential types after we have left it. We update the parent |
| 477 // of the try block so that, at exit of the try block, we get | 478 // of the try block so that, at exit of the try block, we get |
| 478 // the right phi for it. | 479 // the right phi for it. |
| 479 T existing = tryBlock.locals.parent[local]; | 480 T existing = tryBlock.locals.parent[local]; |
| 480 if (existing != null) { | 481 if (existing != null) { |
| (...skipping 1002 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1483 return type; | 1484 return type; |
| 1484 } | 1485 } |
| 1485 | 1486 |
| 1486 T visitCascade(Cascade node) { | 1487 T visitCascade(Cascade node) { |
| 1487 // Ignore the result of the cascade send and return the type of the cascade | 1488 // Ignore the result of the cascade send and return the type of the cascade |
| 1488 // receiver. | 1489 // receiver. |
| 1489 visit(node.expression); | 1490 visit(node.expression); |
| 1490 return cascadeReceiverStack.removeLast(); | 1491 return cascadeReceiverStack.removeLast(); |
| 1491 } | 1492 } |
| 1492 } | 1493 } |
| OLD | NEW |