| OLD | NEW |
| 1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2012, 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 universe; | 5 library universe; |
| 6 | 6 |
| 7 import '../elements/elements.dart'; | 7 import '../elements/elements.dart'; |
| 8 import '../dart2jslib.dart'; | 8 import '../dart2jslib.dart'; |
| 9 import '../dart_types.dart'; | 9 import '../dart_types.dart'; |
| 10 import '../types/types.dart'; | 10 import '../types/types.dart'; |
| (...skipping 730 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 741 hashCode) { | 741 hashCode) { |
| 742 assert(mask != null); | 742 assert(mask != null); |
| 743 assert(asUntyped.mask == null); | 743 assert(asUntyped.mask == null); |
| 744 } | 744 } |
| 745 | 745 |
| 746 static Map<Selector, Map<TypeMask, TypedSelector>> canonicalizedValues = | 746 static Map<Selector, Map<TypeMask, TypedSelector>> canonicalizedValues = |
| 747 new Map<Selector, Map<TypeMask, TypedSelector>>(); | 747 new Map<Selector, Map<TypeMask, TypedSelector>>(); |
| 748 | 748 |
| 749 factory TypedSelector(TypeMask mask, Selector selector, World world) { | 749 factory TypedSelector(TypeMask mask, Selector selector, World world) { |
| 750 if (!world.hasClosedWorldAssumption) { | 750 if (!world.hasClosedWorldAssumption) { |
| 751 // TODO(johnniwinther): Improve use of TypedSelector in an open world. |
| 751 bool isNullable = mask.isNullable; | 752 bool isNullable = mask.isNullable; |
| 752 mask = world.compiler.typesTask.dynamicType; | 753 mask = world.compiler.typesTask.dynamicType; |
| 753 if (isNullable) { | 754 if (isNullable) { |
| 754 mask = mask.nullable(); | 755 mask = mask.nullable(); |
| 755 } | 756 } |
| 756 } | 757 } |
| 757 // TODO(johnniwinther): Allow more TypeSelector kinds during resoluton. | 758 // TODO(johnniwinther): Allow more TypeSelector kinds during resoluton. |
| 758 assert(world.isClosed || mask.isExact); | 759 assert(world.isClosed || mask.isExact); |
| 759 if (selector.mask == mask) return selector; | 760 if (selector.mask == mask) return selector; |
| 760 Selector untyped = selector.asUntyped; | 761 Selector untyped = selector.asUntyped; |
| (...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 803 | 804 |
| 804 Selector extendIfReachesAll(Compiler compiler) { | 805 Selector extendIfReachesAll(Compiler compiler) { |
| 805 bool canReachAll = compiler.enabledInvokeOn | 806 bool canReachAll = compiler.enabledInvokeOn |
| 806 && mask.needsNoSuchMethodHandling(this, compiler.world); | 807 && mask.needsNoSuchMethodHandling(this, compiler.world); |
| 807 return canReachAll | 808 return canReachAll |
| 808 ? new TypedSelector( | 809 ? new TypedSelector( |
| 809 compiler.typesTask.dynamicType, this, compiler.world) | 810 compiler.typesTask.dynamicType, this, compiler.world) |
| 810 : this; | 811 : this; |
| 811 } | 812 } |
| 812 } | 813 } |
| OLD | NEW |