Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(237)

Side by Side Diff: lib/compiler/implementation/universe.dart

Issue 10900023: A class can implement another class, so a selector on a class applies to a member that implements t… (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
Patch Set: Created 8 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
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 class Universe { 5 class Universe {
6 Map<Element, CodeBuffer> generatedCode; 6 Map<Element, CodeBuffer> generatedCode;
7 Map<Element, CodeBuffer> generatedBailoutCode; 7 Map<Element, CodeBuffer> generatedBailoutCode;
8 final Set<ClassElement> instantiatedClasses; 8 final Set<ClassElement> instantiatedClasses;
9 final Set<SourceString> instantiatedClassInstanceFields; 9 final Set<SourceString> instantiatedClassInstanceFields;
10 final Set<FunctionElement> staticFunctionsNeedingGetter; 10 final Set<FunctionElement> staticFunctionsNeedingGetter;
(...skipping 357 matching lines...) Expand 10 before | Expand all | Expand 10 after
368 // class A { 368 // class A {
369 // get foo => () => 42; 369 // get foo => () => 42;
370 // bar() => foo(); // The call to 'foo' is a typed selector. 370 // bar() => foo(); // The call to 'foo' is a typed selector.
371 // } 371 // }
372 ClassElement other = element.getEnclosingClass(); 372 ClassElement other = element.getEnclosingClass();
373 if (other.superclass === compiler.closureClass) { 373 if (other.superclass === compiler.closureClass) {
374 return appliesUntyped(element, compiler); 374 return appliesUntyped(element, compiler);
375 } 375 }
376 376
377 ClassElement self = receiverType.element; 377 ClassElement self = receiverType.element;
378 // TODO(ngeoffray): tree-shake on interfaces. 378 if (other.implementsInterface(self) || other.isSubclassOf(self)) {
kasperl 2012/08/29 11:57:36 So this is essentially a subtype (not subclass) ch
ngeoffray 2012/08/29 12:13:50 It does. I added another test to make sure we don'
379 if (self.isInterface() || other.isSubclassOf(self)) {
380 return appliesUntyped(element, compiler); 379 return appliesUntyped(element, compiler);
381 } 380 }
382 381
383 if (!self.isInterface() && self.isSubclassOf(other)) { 382 if (!self.isInterface() && self.isSubclassOf(other)) {
384 // Resolve an invocation of [element.name] on [self]. If it 383 // Resolve an invocation of [element.name] on [self]. If it
385 // is found, this selector is a candidate. 384 // is found, this selector is a candidate.
386 return hasElementIn(self, element) && appliesUntyped(element, compiler); 385 return hasElementIn(self, element) && appliesUntyped(element, compiler);
387 } 386 }
388 387
389 return false; 388 return false;
390 } 389 }
391 390
392 toString() { 391 toString() {
393 return 'Selector($kind, "${name.slowToString()}", ' 392 return 'Selector($kind, "${name.slowToString()}", '
394 '$argumentCount, type=$receiverType)'; 393 '$argumentCount, type=$receiverType)';
395 } 394 }
396 } 395 }
OLDNEW
« no previous file with comments | « no previous file | tests/language/language_dart2js.status » ('j') | tests/language/tree_shake_typed_selector_test.dart » ('J')

Powered by Google App Engine
This is Rietveld 408576698