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 745 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
756 | 756 |
757 @override | 757 @override |
758 T apply(Node node, _) => visit(node); | 758 T apply(Node node, _) => visit(node); |
759 | 759 |
760 T handleSendSet(SendSet node); | 760 T handleSendSet(SendSet node); |
761 | 761 |
762 T handleDynamicInvoke(Send node); | 762 T handleDynamicInvoke(Send node); |
763 | 763 |
764 T visitAssert(Assert node) { | 764 T visitAssert(Assert node) { |
765 // Avoid pollution from assert statement unless enabled. | 765 // Avoid pollution from assert statement unless enabled. |
766 if (compiler.options.enableUserAssertions) { | 766 if (!compiler.options.enableUserAssertions) { |
767 super.visitAssert(node); | 767 return null; |
768 } | 768 } |
| 769 List<Send> tests = <Send>[]; |
| 770 bool simpleCondition = handleCondition(node.condition, tests); |
| 771 LocalsHandler<T> saved = locals; |
| 772 locals = new LocalsHandler<T>.from(locals, node); |
| 773 updateIsChecks(tests, usePositive: true); |
| 774 |
| 775 LocalsHandler<T> thenLocals = locals; |
| 776 locals = new LocalsHandler<T>.from(saved, node); |
| 777 if (simpleCondition) updateIsChecks(tests, usePositive: false); |
| 778 visit(node.message); |
| 779 locals.seenReturnOrThrow = true; |
| 780 saved.mergeDiamondFlow(thenLocals, locals); |
| 781 locals = saved; |
769 return null; | 782 return null; |
770 } | 783 } |
771 | 784 |
772 T visitAsyncForIn(AsyncForIn node); | 785 T visitAsyncForIn(AsyncForIn node); |
773 | 786 |
774 T visitSyncForIn(SyncForIn node); | 787 T visitSyncForIn(SyncForIn node); |
775 | 788 |
776 T visitReturn(Return node); | 789 T visitReturn(Return node); |
777 | 790 |
778 T visitFunctionExpression(FunctionExpression node); | 791 T visitFunctionExpression(FunctionExpression node); |
(...skipping 698 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1477 return type; | 1490 return type; |
1478 } | 1491 } |
1479 | 1492 |
1480 T visitCascade(Cascade node) { | 1493 T visitCascade(Cascade node) { |
1481 // Ignore the result of the cascade send and return the type of the cascade | 1494 // Ignore the result of the cascade send and return the type of the cascade |
1482 // receiver. | 1495 // receiver. |
1483 visit(node.expression); | 1496 visit(node.expression); |
1484 return cascadeReceiverStack.removeLast(); | 1497 return cascadeReceiverStack.removeLast(); |
1485 } | 1498 } |
1486 } | 1499 } |
OLD | NEW |