| 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 '../constants/constant_system.dart'; | 7 import '../constants/constant_system.dart'; |
| 8 import '../constants/expressions.dart'; |
| 8 import '../dart2jslib.dart' hide Selector, TypedSelector; | 9 import '../dart2jslib.dart' hide Selector, TypedSelector; |
| 9 import '../dart_types.dart'; | 10 import '../dart_types.dart'; |
| 10 import '../elements/elements.dart'; | 11 import '../elements/elements.dart'; |
| 11 import '../tree/tree.dart'; | 12 import '../tree/tree.dart'; |
| 12 import '../universe/universe.dart'; | 13 import '../universe/universe.dart'; |
| 13 import '../util/util.dart'; | 14 import '../util/util.dart'; |
| 14 import '../types/types.dart' show TypeMask; | 15 import '../types/types.dart' show TypeMask; |
| 15 import '../types/constants.dart' show computeTypeMask; | 16 import '../types/constants.dart' show computeTypeMask; |
| 16 import 'dart:collection' show IterableMixin; | 17 import 'dart:collection' show IterableMixin; |
| 17 | 18 |
| (...skipping 787 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 805 // symbol is always a non-null exact symbol implementation -- not just | 806 // symbol is always a non-null exact symbol implementation -- not just |
| 806 // any non-null subtype of the symbol interface. | 807 // any non-null subtype of the symbol interface. |
| 807 return types.nonNullSubtype(compiler.symbolClass); | 808 return types.nonNullSubtype(compiler.symbolClass); |
| 808 } | 809 } |
| 809 | 810 |
| 810 T visitTypePrefixSend(Send node) { | 811 T visitTypePrefixSend(Send node) { |
| 811 // TODO(johnniwinther): Remove the need for handling this node. | 812 // TODO(johnniwinther): Remove the need for handling this node. |
| 812 return types.dynamicType; | 813 return types.dynamicType; |
| 813 } | 814 } |
| 814 | 815 |
| 815 T visitTypeLiteralSend(Send node) { | 816 T handleTypeLiteralGet() { |
| 816 return types.typeType; | 817 return types.typeType; |
| 817 } | 818 } |
| 818 | 819 |
| 820 T handleTypeLiteralInvoke(NodeList arguments) { |
| 821 return types.dynamicType; |
| 822 } |
| 823 |
| 824 T visitClassTypeLiteralGet( |
| 825 Send node, |
| 826 ConstantExpression constant, |
| 827 _) { |
| 828 return handleTypeLiteralGet(); |
| 829 } |
| 830 |
| 831 T visitClassTypeLiteralInvoke( |
| 832 Send node, |
| 833 ConstantExpression constant, |
| 834 NodeList arguments, |
| 835 CallStructure callStructure, |
| 836 _) { |
| 837 return handleTypeLiteralInvoke(arguments); |
| 838 } |
| 839 |
| 840 T visitTypedefTypeLiteralGet( |
| 841 Send node, |
| 842 ConstantExpression constant, |
| 843 _) { |
| 844 return handleTypeLiteralGet(); |
| 845 } |
| 846 |
| 847 T visitTypedefTypeLiteralInvoke( |
| 848 Send node, |
| 849 ConstantExpression constant, |
| 850 NodeList arguments, |
| 851 CallStructure callStructure, |
| 852 _) { |
| 853 return handleTypeLiteralInvoke(arguments); |
| 854 } |
| 855 |
| 856 T visitTypeVariableTypeLiteralGet( |
| 857 Send node, |
| 858 TypeVariableElement element, |
| 859 _) { |
| 860 return handleTypeLiteralGet(); |
| 861 } |
| 862 |
| 863 T visitTypeVariableTypeLiteralInvoke( |
| 864 Send node, |
| 865 TypeVariableElement element, |
| 866 NodeList arguments, |
| 867 CallStructure callStructure, |
| 868 _) { |
| 869 return handleTypeLiteralInvoke(arguments); |
| 870 } |
| 871 |
| 872 T visitDynamicTypeLiteralGet( |
| 873 Send node, |
| 874 ConstantExpression constant, |
| 875 _) { |
| 876 return handleTypeLiteralGet(); |
| 877 } |
| 878 |
| 879 T visitDynamicTypeLiteralInvoke( |
| 880 Send node, |
| 881 ConstantExpression constant, |
| 882 NodeList arguments, |
| 883 CallStructure callStructure, |
| 884 _) { |
| 885 return handleTypeLiteralInvoke(arguments); |
| 886 } |
| 887 |
| 819 bool isThisOrSuper(Node node) => node.isThis() || node.isSuper(); | 888 bool isThisOrSuper(Node node) => node.isThis() || node.isSuper(); |
| 820 | 889 |
| 821 Element get outermostElement { | 890 Element get outermostElement { |
| 822 return analyzedElement.outermostEnclosingMemberOrTopLevel.implementation; | 891 return analyzedElement.outermostEnclosingMemberOrTopLevel.implementation; |
| 823 } | 892 } |
| 824 | 893 |
| 825 T _thisType; | 894 T _thisType; |
| 826 T get thisType { | 895 T get thisType { |
| 827 if (_thisType != null) return _thisType; | 896 if (_thisType != null) return _thisType; |
| 828 ClassElement cls = outermostElement.enclosingClass; | 897 ClassElement cls = outermostElement.enclosingClass; |
| (...skipping 479 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1308 return type; | 1377 return type; |
| 1309 } | 1378 } |
| 1310 | 1379 |
| 1311 T visitCascade(Cascade node) { | 1380 T visitCascade(Cascade node) { |
| 1312 // Ignore the result of the cascade send and return the type of the cascade | 1381 // Ignore the result of the cascade send and return the type of the cascade |
| 1313 // receiver. | 1382 // receiver. |
| 1314 visit(node.expression); | 1383 visit(node.expression); |
| 1315 return cascadeReceiverStack.removeLast(); | 1384 return cascadeReceiverStack.removeLast(); |
| 1316 } | 1385 } |
| 1317 } | 1386 } |
| OLD | NEW |