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

Issue 10900023: A class can implement another class, so a selector on a class applies to a member that implements t… (Closed)

Created:
8 years, 3 months ago by ngeoffray
Modified:
8 years, 3 months ago
Reviewers:
Søren Gjesse, kasperl
CC:
reviews_dartlang.org
Visibility:
Public.

Description

A class can implement another class, so a selector on a class applies to a member that implements that class. Committed: https://code.google.com/p/dart/source/detail?r=11516

Patch Set 1 : #

Total comments: 4

Patch Set 2 : #

Unified diffs Side-by-side diffs Delta from patch set Stats (+56 lines, -7 lines) Patch
M lib/compiler/implementation/universe.dart View 1 1 chunk +1 line, -2 lines 0 comments Download
M tests/compiler/dart2js/dart2js.status View 1 1 chunk +1 line, -0 lines 0 comments Download
A tests/compiler/dart2js/tree_shaking_test.dart View 1 1 chunk +31 lines, -0 lines 0 comments Download
M tests/language/language_dart2js.status View 1 1 chunk +0 lines, -5 lines 0 comments Download
A tests/language/tree_shake_typed_selector_test.dart View 1 1 chunk +23 lines, -0 lines 0 comments Download

Messages

Total messages: 4 (0 generated)
ngeoffray
8 years, 3 months ago (2012-08-29 11:29:57 UTC) #1
Søren Gjesse
lgtm
8 years, 3 months ago (2012-08-29 11:55:45 UTC) #2
kasperl
LGTM, but I think we can do better. https://chromiumcodereview.appspot.com/10900023/diff/2001/lib/compiler/implementation/universe.dart File lib/compiler/implementation/universe.dart (right): https://chromiumcodereview.appspot.com/10900023/diff/2001/lib/compiler/implementation/universe.dart#newcode378 lib/compiler/implementation/universe.dart:378: if ...
8 years, 3 months ago (2012-08-29 11:57:36 UTC) #3
ngeoffray
8 years, 3 months ago (2012-08-29 12:13:50 UTC) #4
Thanks Soren and Kasper

https://chromiumcodereview.appspot.com/10900023/diff/2001/lib/compiler/implem...
File lib/compiler/implementation/universe.dart (right):

https://chromiumcodereview.appspot.com/10900023/diff/2001/lib/compiler/implem...
lib/compiler/implementation/universe.dart:378: if
(other.implementsInterface(self) || other.isSubclassOf(self)) {
On 2012/08/29 11:57:36, kasperl wrote:
> So this is essentially a subtype (not subclass) check? This is probably
correct,
> but I'm not sure it's optimal. I think we need to distinguish between two
kinds
> of typed selectors: One that is guaranteed to be invoked on a subclass of the
> receiverType -- and one that can be invoked on any subtype of the
receiverType. 
> 
> We can trivially use the subclass variant for calls on 'this' and in most
cases
> where we have concrete type information (here we can actually do better
because
> we know that it cannot even be a subclass), but for typed selectors introduced
> because of data flow and 'is' checks we need the subtype variant.
> 
> Does that make sense?

It does. I added another test to make sure we don't forget about this
optimization.

https://chromiumcodereview.appspot.com/10900023/diff/2001/tests/language/tree...
File tests/language/tree_shake_typed_selector_test.dart (right):

https://chromiumcodereview.appspot.com/10900023/diff/2001/tests/language/tree...
tests/language/tree_shake_typed_selector_test.dart:8: factory A() {
On 2012/08/29 11:57:36, kasperl wrote:
> Use => syntax?

Done.

Powered by Google App Engine
This is Rietveld 408576698