| 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 '../closure.dart'; | 7 import '../closure.dart'; |
| 8 import '../elements/elements.dart'; | 8 import '../elements/elements.dart'; |
| 9 import '../dart2jslib.dart'; | 9 import '../dart2jslib.dart'; |
| 10 import '../tree/tree.dart'; | 10 import '../tree/tree.dart'; |
| (...skipping 364 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 375 * The type of the receiver. Any subtype of that type can be the | 375 * The type of the receiver. Any subtype of that type can be the |
| 376 * target of the invocation. | 376 * target of the invocation. |
| 377 */ | 377 */ |
| 378 final DartType receiverType; | 378 final DartType receiverType; |
| 379 | 379 |
| 380 TypedSelector(DartType this.receiverType, Selector selector) | 380 TypedSelector(DartType this.receiverType, Selector selector) |
| 381 : super(selector.kind, | 381 : super(selector.kind, |
| 382 selector.name, | 382 selector.name, |
| 383 selector.library, | 383 selector.library, |
| 384 selector.argumentCount, | 384 selector.argumentCount, |
| 385 selector.namedArguments); | 385 selector.namedArguments) { |
| 386 // Invariant: Typed selector can not be based on a malformed type. |
| 387 assert(!identical(receiverType.kind, TypeKind.MALFORMED_TYPE)); |
| 388 } |
| 386 | 389 |
| 387 /** | 390 /** |
| 388 * Check if [element] will be the one used at runtime when being | 391 * Check if [element] will be the one used at runtime when being |
| 389 * invoked on an instance of [cls]. | 392 * invoked on an instance of [cls]. |
| 390 */ | 393 */ |
| 391 bool hasElementIn(ClassElement cls, Element element) { | 394 bool hasElementIn(ClassElement cls, Element element) { |
| 392 Element resolved = cls.lookupMember(element.name); | 395 Element resolved = cls.lookupMember(element.name); |
| 393 if (identical(resolved, element)) return true; | 396 if (identical(resolved, element)) return true; |
| 394 if (resolved == null) return false; | 397 if (resolved == null) return false; |
| 395 if (identical(resolved.kind, ElementKind.ABSTRACT_FIELD)) { | 398 if (identical(resolved.kind, ElementKind.ABSTRACT_FIELD)) { |
| (...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 439 ClassElement cls = self; | 442 ClassElement cls = self; |
| 440 if (cls.isSubclassOf(other)) { | 443 if (cls.isSubclassOf(other)) { |
| 441 // Resolve an invocation of [element.name] on [self]. If it | 444 // Resolve an invocation of [element.name] on [self]. If it |
| 442 // is found, this selector is a candidate. | 445 // is found, this selector is a candidate. |
| 443 return hasElementIn(self, element) && appliesUntyped(element, compiler); | 446 return hasElementIn(self, element) && appliesUntyped(element, compiler); |
| 444 } | 447 } |
| 445 | 448 |
| 446 return false; | 449 return false; |
| 447 } | 450 } |
| 448 } | 451 } |
| OLD | NEW |