Chromium Code Reviews| 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 ClassElement self = receiverType.element; |
|
ahe
2012/11/05 08:33:32
Doesn't this fail in checked mode?
ngeoffray
2012/11/05 10:51:03
Good catch. The test I wrote was not complete.
| |
| 426 | 426 |
| 427 if (other.implementsInterface(self) | 427 if (other.implementsInterface(self) |
| 428 || other.isSubclassOf(self) | 428 || other.isSubclassOf(self) |
| 429 || compiler.world.hasAnySubclassThatImplements(other, receiverType)) { | 429 || compiler.world.hasAnySubclassThatImplements(other, receiverType)) { |
| 430 return appliesUntyped(element, compiler); | 430 return appliesUntyped(element, compiler); |
| 431 } | 431 } |
| 432 | 432 |
| 433 if (!self.isInterface() && self.isSubclassOf(other)) { | 433 if (!self.isTypedef() && !self.isInterface() && self.isSubclassOf(other)) { |
|
ahe
2012/11/05 08:33:32
I think it would be better with a positive test, s
ngeoffray
2012/11/05 10:51:03
Done.
| |
| 434 // Resolve an invocation of [element.name] on [self]. If it | 434 // Resolve an invocation of [element.name] on [self]. If it |
| 435 // is found, this selector is a candidate. | 435 // is found, this selector is a candidate. |
| 436 return hasElementIn(self, element) && appliesUntyped(element, compiler); | 436 return hasElementIn(self, element) && appliesUntyped(element, compiler); |
| 437 } | 437 } |
| 438 | 438 |
| 439 return false; | 439 return false; |
| 440 } | 440 } |
| 441 } | 441 } |
| OLD | NEW |