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 compiler.src.inferrer.type_graph_nodes; | 5 library compiler.src.inferrer.type_graph_nodes; |
6 | 6 |
7 import 'dart:collection' show IterableBase; | 7 import 'dart:collection' show IterableBase; |
8 | 8 |
9 import '../common.dart'; | 9 import '../common.dart'; |
10 import '../common/names.dart' show Identifiers; | 10 import '../common/names.dart' show Identifiers; |
(...skipping 839 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
850 } else { | 850 } else { |
851 return mask; | 851 return mask; |
852 } | 852 } |
853 } | 853 } |
854 | 854 |
855 bool targetsIncludeComplexNoSuchMethod(InferrerEngine inferrer) { | 855 bool targetsIncludeComplexNoSuchMethod(InferrerEngine inferrer) { |
856 return targets.any((Element e) { | 856 return targets.any((Element e) { |
857 return e is FunctionElement && | 857 return e is FunctionElement && |
858 e.isInstanceMember && | 858 e.isInstanceMember && |
859 e.name == Identifiers.noSuchMethod_ && | 859 e.name == Identifiers.noSuchMethod_ && |
860 inferrer.backend.isComplexNoSuchMethod(e); | 860 inferrer.backend.noSuchMethodRegistry.isComplex(e); |
861 }); | 861 }); |
862 } | 862 } |
863 | 863 |
864 /** | 864 /** |
865 * We optimize certain operations on the [int] class because we know more | 865 * We optimize certain operations on the [int] class because we know more |
866 * about their return type than the actual Dart code. For example, we know int | 866 * about their return type than the actual Dart code. For example, we know int |
867 * + int returns an int. The Dart library code for [int.operator+] only says | 867 * + int returns an int. The Dart library code for [int.operator+] only says |
868 * it returns a [num]. | 868 * it returns a [num]. |
869 * | 869 * |
870 * Returns the more precise TypeInformation, or `null` to defer to the library | 870 * Returns the more precise TypeInformation, or `null` to defer to the library |
(...skipping 872 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1743 } else if (annotation.isVoid) { | 1743 } else if (annotation.isVoid) { |
1744 otherType = closedWorld.commonMasks.nullType; | 1744 otherType = closedWorld.commonMasks.nullType; |
1745 } else { | 1745 } else { |
1746 ResolutionInterfaceType interfaceType = annotation; | 1746 ResolutionInterfaceType interfaceType = annotation; |
1747 otherType = new TypeMask.nonNullSubtype(interfaceType.element, closedWorld); | 1747 otherType = new TypeMask.nonNullSubtype(interfaceType.element, closedWorld); |
1748 } | 1748 } |
1749 if (isNullable) otherType = otherType.nullable(); | 1749 if (isNullable) otherType = otherType.nullable(); |
1750 if (type == null) return otherType; | 1750 if (type == null) return otherType; |
1751 return type.intersection(otherType, closedWorld); | 1751 return type.intersection(otherType, closedWorld); |
1752 } | 1752 } |
OLD | NEW |