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 '../runtime_types.dart'; | 10 import '../runtime_types.dart'; |
(...skipping 404 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
415 // A closure can be called through any typed selector: | 415 // A closure can be called through any typed selector: |
416 // class A { | 416 // class A { |
417 // get foo => () => 42; | 417 // get foo => () => 42; |
418 // bar() => foo(); // The call to 'foo' is a typed selector. | 418 // bar() => foo(); // The call to 'foo' is a typed selector. |
419 // } | 419 // } |
420 ClassElement other = element.getEnclosingClass(); | 420 ClassElement other = element.getEnclosingClass(); |
421 if (identical(other.superclass, compiler.closureClass)) { | 421 if (identical(other.superclass, compiler.closureClass)) { |
422 return appliesUntyped(element, compiler); | 422 return appliesUntyped(element, compiler); |
423 } | 423 } |
424 | 424 |
425 ClassElement self = receiverType.element; | 425 Element self = receiverType.element; |
426 if (self.isTypedef()) { | |
427 // A typedef is a function type that doesn't have any | |
428 // user-defined member. | |
ahe
2012/11/05 11:23:01
member -> members.
ngeoffray
2012/11/05 11:40:01
Done.
ngeoffray
2012/11/05 11:40:01
Done.
| |
429 return false; | |
430 } | |
426 | 431 |
427 if (other.implementsInterface(self) | 432 if (other.implementsInterface(self) |
428 || other.isSubclassOf(self) | 433 || other.isSubclassOf(self) |
429 || compiler.world.hasAnySubclassThatImplements(other, receiverType)) { | 434 || compiler.world.hasAnySubclassThatImplements(other, receiverType)) { |
430 return appliesUntyped(element, compiler); | 435 return appliesUntyped(element, compiler); |
431 } | 436 } |
432 | 437 |
433 if (!self.isTypedef() && !self.isInterface() && self.isSubclassOf(other)) { | 438 if (self.isSubclassOf(other)) { |
ahe
2012/11/05 11:23:01
Should this be checking subtype relation instead?
ngeoffray
2012/11/05 11:40:01
No, this is checking if [element] (which is define
| |
434 // Resolve an invocation of [element.name] on [self]. If it | 439 // Resolve an invocation of [element.name] on [self]. If it |
435 // is found, this selector is a candidate. | 440 // is found, this selector is a candidate. |
436 return hasElementIn(self, element) && appliesUntyped(element, compiler); | 441 return hasElementIn(self, element) && appliesUntyped(element, compiler); |
437 } | 442 } |
438 | 443 |
439 return false; | 444 return false; |
440 } | 445 } |
441 } | 446 } |
OLD | NEW |