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 | 7 import 'dart:collection' show |
8 IterableMixin; | 8 IterableMixin; |
9 | 9 |
10 import '../compiler.dart' show | 10 import '../compiler.dart' show |
(...skipping 740 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
751 @override | 751 @override |
752 SemanticSendVisitor get sendVisitor => this; | 752 SemanticSendVisitor get sendVisitor => this; |
753 | 753 |
754 @override | 754 @override |
755 T apply(Node node, _) => visit(node); | 755 T apply(Node node, _) => visit(node); |
756 | 756 |
757 T handleSendSet(SendSet node); | 757 T handleSendSet(SendSet node); |
758 | 758 |
759 T handleDynamicInvoke(Send node); | 759 T handleDynamicInvoke(Send node); |
760 | 760 |
761 T visitAssert(Assert node) { | |
762 // Avoid pollution from assert statement unless enabled. | |
763 if (compiler.enableUserAssertions) { | |
764 super.visitAssert(node); | |
765 } | |
766 return null; | |
767 } | |
768 | |
769 T visitAsyncForIn(AsyncForIn node); | 761 T visitAsyncForIn(AsyncForIn node); |
770 | 762 |
771 T visitSyncForIn(SyncForIn node); | 763 T visitSyncForIn(SyncForIn node); |
772 | 764 |
773 T visitReturn(Return node); | 765 T visitReturn(Return node); |
774 | 766 |
775 T visitFunctionExpression(FunctionExpression node); | 767 T visitFunctionExpression(FunctionExpression node); |
776 | 768 |
777 @override | 769 @override |
778 T bulkHandleSet(SendSet node, _) { | 770 T bulkHandleSet(SendSet node, _) { |
(...skipping 18 matching lines...) Expand all Loading... |
797 @override | 789 @override |
798 T bulkHandlePostfix(SendSet node, _) { | 790 T bulkHandlePostfix(SendSet node, _) { |
799 return handleSendSet(node); | 791 return handleSendSet(node); |
800 } | 792 } |
801 | 793 |
802 @override | 794 @override |
803 T bulkHandleError(Node node, ErroneousElement error, _) { | 795 T bulkHandleError(Node node, ErroneousElement error, _) { |
804 return types.dynamicType; | 796 return types.dynamicType; |
805 } | 797 } |
806 | 798 |
| 799 @override |
| 800 T visitAssert(Send node, Node expression, _) { |
| 801 if (!compiler.enableUserAssertions) { |
| 802 return types.nullType; |
| 803 } |
| 804 return handleAssert(node, expression); |
| 805 } |
| 806 |
| 807 /// Handle an enabled assertion of [expression]. |
| 808 T handleAssert(Send node, Node expression); |
| 809 |
807 T visitNode(Node node) { | 810 T visitNode(Node node) { |
808 return node.visitChildren(this); | 811 return node.visitChildren(this); |
809 } | 812 } |
810 | 813 |
811 T visit(Node node) { | 814 T visit(Node node) { |
812 return node == null ? null : node.accept(this); | 815 return node == null ? null : node.accept(this); |
813 } | 816 } |
814 | 817 |
815 T visitFunctionDeclaration(FunctionDeclaration node) { | 818 T visitFunctionDeclaration(FunctionDeclaration node) { |
816 locals.update(elements[node], types.functionType, node); | 819 locals.update(elements[node], types.functionType, node); |
(...skipping 716 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1533 return type; | 1536 return type; |
1534 } | 1537 } |
1535 | 1538 |
1536 T visitCascade(Cascade node) { | 1539 T visitCascade(Cascade node) { |
1537 // Ignore the result of the cascade send and return the type of the cascade | 1540 // Ignore the result of the cascade send and return the type of the cascade |
1538 // receiver. | 1541 // receiver. |
1539 visit(node.expression); | 1542 visit(node.expression); |
1540 return cascadeReceiverStack.removeLast(); | 1543 return cascadeReceiverStack.removeLast(); |
1541 } | 1544 } |
1542 } | 1545 } |
OLD | NEW |