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 764 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
775 @override | 775 @override |
776 T bulkHandlePrefix(SendSet node, _) { | 776 T bulkHandlePrefix(SendSet node, _) { |
777 return handleSendSet(node); | 777 return handleSendSet(node); |
778 } | 778 } |
779 | 779 |
780 @override | 780 @override |
781 T bulkHandlePostfix(SendSet node, _) { | 781 T bulkHandlePostfix(SendSet node, _) { |
782 return handleSendSet(node); | 782 return handleSendSet(node); |
783 } | 783 } |
784 | 784 |
785 @override | |
786 T visitAssert(Send node, Node expression, _) { | |
787 if (!compiler.enableUserAssertions) { | |
788 return types.nullType; | |
789 } | |
790 return handleAssert(node, expression); | |
791 } | |
792 | |
793 /// Handle an enabled assertion of [expression]. | |
794 T handleAssert(Send node, Node expression); | |
795 | |
796 T visitNode(Node node) { | 785 T visitNode(Node node) { |
797 return node.visitChildren(this); | 786 return node.visitChildren(this); |
798 } | 787 } |
799 | 788 |
800 T visit(Node node) { | 789 T visit(Node node) { |
801 return node == null ? null : node.accept(this); | 790 return node == null ? null : node.accept(this); |
802 } | 791 } |
803 | 792 |
804 T visitFunctionDeclaration(FunctionDeclaration node) { | 793 T visitFunctionDeclaration(FunctionDeclaration node) { |
805 locals.update(elements[node], types.functionType, node); | 794 locals.update(elements[node], types.functionType, node); |
(...skipping 716 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1522 return type; | 1511 return type; |
1523 } | 1512 } |
1524 | 1513 |
1525 T visitCascade(Cascade node) { | 1514 T visitCascade(Cascade node) { |
1526 // Ignore the result of the cascade send and return the type of the cascade | 1515 // Ignore the result of the cascade send and return the type of the cascade |
1527 // receiver. | 1516 // receiver. |
1528 visit(node.expression); | 1517 visit(node.expression); |
1529 return cascadeReceiverStack.removeLast(); | 1518 return cascadeReceiverStack.removeLast(); |
1530 } | 1519 } |
1531 } | 1520 } |
OLD | NEW |