| 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 |
| 761 T visitAsyncForIn(AsyncForIn node); | 769 T visitAsyncForIn(AsyncForIn node); |
| 762 | 770 |
| 763 T visitSyncForIn(SyncForIn node); | 771 T visitSyncForIn(SyncForIn node); |
| 764 | 772 |
| 765 T visitReturn(Return node); | 773 T visitReturn(Return node); |
| 766 | 774 |
| 767 T visitFunctionExpression(FunctionExpression node); | 775 T visitFunctionExpression(FunctionExpression node); |
| 768 | 776 |
| 769 @override | 777 @override |
| 770 T bulkHandleSet(SendSet node, _) { | 778 T bulkHandleSet(SendSet node, _) { |
| (...skipping 18 matching lines...) Expand all Loading... |
| 789 @override | 797 @override |
| 790 T bulkHandlePostfix(SendSet node, _) { | 798 T bulkHandlePostfix(SendSet node, _) { |
| 791 return handleSendSet(node); | 799 return handleSendSet(node); |
| 792 } | 800 } |
| 793 | 801 |
| 794 @override | 802 @override |
| 795 T bulkHandleError(Node node, ErroneousElement error, _) { | 803 T bulkHandleError(Node node, ErroneousElement error, _) { |
| 796 return types.dynamicType; | 804 return types.dynamicType; |
| 797 } | 805 } |
| 798 | 806 |
| 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 | |
| 810 T visitNode(Node node) { | 807 T visitNode(Node node) { |
| 811 return node.visitChildren(this); | 808 return node.visitChildren(this); |
| 812 } | 809 } |
| 813 | 810 |
| 814 T visit(Node node) { | 811 T visit(Node node) { |
| 815 return node == null ? null : node.accept(this); | 812 return node == null ? null : node.accept(this); |
| 816 } | 813 } |
| 817 | 814 |
| 818 T visitFunctionDeclaration(FunctionDeclaration node) { | 815 T visitFunctionDeclaration(FunctionDeclaration node) { |
| 819 locals.update(elements[node], types.functionType, node); | 816 locals.update(elements[node], types.functionType, node); |
| (...skipping 716 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1536 return type; | 1533 return type; |
| 1537 } | 1534 } |
| 1538 | 1535 |
| 1539 T visitCascade(Cascade node) { | 1536 T visitCascade(Cascade node) { |
| 1540 // Ignore the result of the cascade send and return the type of the cascade | 1537 // Ignore the result of the cascade send and return the type of the cascade |
| 1541 // receiver. | 1538 // receiver. |
| 1542 visit(node.expression); | 1539 visit(node.expression); |
| 1543 return cascadeReceiverStack.removeLast(); | 1540 return cascadeReceiverStack.removeLast(); |
| 1544 } | 1541 } |
| 1545 } | 1542 } |
| OLD | NEW |