| 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 world_builder; | 5 library world_builder; |
| 6 | 6 |
| 7 import 'dart:collection'; | 7 import 'dart:collection'; |
| 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 78 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 89 /// class A { | 89 /// class A { |
| 90 /// foo(a, b) {} | 90 /// foo(a, b) {} |
| 91 /// } | 91 /// } |
| 92 /// class B { | 92 /// class B { |
| 93 /// foo(a, b) {} | 93 /// foo(a, b) {} |
| 94 /// } | 94 /// } |
| 95 /// new A().foo(a, b); | 95 /// new A().foo(a, b); |
| 96 /// | 96 /// |
| 97 /// Ideally the selector constraints for calls `foo` with two positional | 97 /// Ideally the selector constraints for calls `foo` with two positional |
| 98 /// arguments apply to `A.foo` but `B.foo`. | 98 /// arguments apply to `A.foo` but `B.foo`. |
| 99 bool applies(MemberElement element, Selector selector, World world); | 99 bool applies(MemberEntity element, Selector selector, World world); |
| 100 | 100 |
| 101 /// Returns `true` if at least one of the receivers matching these constraints | 101 /// Returns `true` if at least one of the receivers matching these constraints |
| 102 /// in the closed [world] have no implementation matching [selector]. | 102 /// in the closed [world] have no implementation matching [selector]. |
| 103 /// | 103 /// |
| 104 /// For instance for this code snippet | 104 /// For instance for this code snippet |
| 105 /// | 105 /// |
| 106 /// class A {} | 106 /// class A {} |
| 107 /// class B { foo() {} } | 107 /// class B { foo() {} } |
| 108 /// m(b) => (b ? new A() : new B()).foo(); | 108 /// m(b) => (b ? new A() : new B()).foo(); |
| 109 /// | 109 /// |
| (...skipping 22 matching lines...) Expand all Loading... |
| 132 | 132 |
| 133 OpenWorldConstraints createSelectorConstraints(Selector selector) { | 133 OpenWorldConstraints createSelectorConstraints(Selector selector) { |
| 134 return new OpenWorldConstraints(); | 134 return new OpenWorldConstraints(); |
| 135 } | 135 } |
| 136 } | 136 } |
| 137 | 137 |
| 138 class OpenWorldConstraints extends UniverseSelectorConstraints { | 138 class OpenWorldConstraints extends UniverseSelectorConstraints { |
| 139 bool isAll = false; | 139 bool isAll = false; |
| 140 | 140 |
| 141 @override | 141 @override |
| 142 bool applies(Element element, Selector selector, World world) => isAll; | 142 bool applies(MemberEntity element, Selector selector, World world) => isAll; |
| 143 | 143 |
| 144 @override | 144 @override |
| 145 bool needsNoSuchMethodHandling(Selector selector, World world) => isAll; | 145 bool needsNoSuchMethodHandling(Selector selector, World world) => isAll; |
| 146 | 146 |
| 147 @override | 147 @override |
| 148 bool addReceiverConstraint(ReceiverConstraint constraint) { | 148 bool addReceiverConstraint(ReceiverConstraint constraint) { |
| 149 if (isAll) return false; | 149 if (isAll) return false; |
| 150 isAll = true; | 150 isAll = true; |
| 151 return true; | 151 return true; |
| 152 } | 152 } |
| (...skipping 23 matching lines...) Expand all Loading... |
| 176 | 176 |
| 177 /// All directly instantiated types, that is, the types of the directly | 177 /// All directly instantiated types, that is, the types of the directly |
| 178 /// instantiated classes. | 178 /// instantiated classes. |
| 179 // TODO(johnniwinther): Improve semantic precision. | 179 // TODO(johnniwinther): Improve semantic precision. |
| 180 Iterable<InterfaceType> get instantiatedTypes; | 180 Iterable<InterfaceType> get instantiatedTypes; |
| 181 | 181 |
| 182 /// Registers that [type] is checked in this world builder. The unaliased type | 182 /// Registers that [type] is checked in this world builder. The unaliased type |
| 183 /// is returned. | 183 /// is returned. |
| 184 void registerIsCheck(DartType type); | 184 void registerIsCheck(DartType type); |
| 185 } | 185 } |
| OLD | NEW |