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 775 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
786 @override | 786 @override |
787 T bulkHandlePostfix(SendSet node, _) { | 787 T bulkHandlePostfix(SendSet node, _) { |
788 return handleSendSet(node); | 788 return handleSendSet(node); |
789 } | 789 } |
790 | 790 |
791 @override | 791 @override |
792 T bulkHandleError(Node node, ErroneousElement error, _) { | 792 T bulkHandleError(Node node, ErroneousElement error, _) { |
793 return types.dynamicType; | 793 return types.dynamicType; |
794 } | 794 } |
795 | 795 |
796 @override | |
797 T visitAssert(Send node, Node expression, _) { | |
798 if (!compiler.enableUserAssertions) { | |
799 return types.nullType; | |
800 } | |
801 return handleAssert(node, expression); | |
802 } | |
803 | |
804 /// Handle an enabled assertion of [expression]. | |
805 T handleAssert(Send node, Node expression); | |
806 | |
807 T visitNode(Node node) { | 796 T visitNode(Node node) { |
808 return node.visitChildren(this); | 797 return node.visitChildren(this); |
809 } | 798 } |
810 | 799 |
811 T visit(Node node) { | 800 T visit(Node node) { |
812 return node == null ? null : node.accept(this); | 801 return node == null ? null : node.accept(this); |
813 } | 802 } |
814 | 803 |
815 T visitFunctionDeclaration(FunctionDeclaration node) { | 804 T visitFunctionDeclaration(FunctionDeclaration node) { |
816 locals.update(elements[node], types.functionType, node); | 805 locals.update(elements[node], types.functionType, node); |
(...skipping 716 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1533 return type; | 1522 return type; |
1534 } | 1523 } |
1535 | 1524 |
1536 T visitCascade(Cascade node) { | 1525 T visitCascade(Cascade node) { |
1537 // Ignore the result of the cascade send and return the type of the cascade | 1526 // Ignore the result of the cascade send and return the type of the cascade |
1538 // receiver. | 1527 // receiver. |
1539 visit(node.expression); | 1528 visit(node.expression); |
1540 return cascadeReceiverStack.removeLast(); | 1529 return cascadeReceiverStack.removeLast(); |
1541 } | 1530 } |
1542 } | 1531 } |
OLD | NEW |