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

Issue 2420073002: Decouple TypeMask from ClassElement (Closed)

Created:
4 years, 2 months ago by Johnni Winther
Modified:
4 years, 2 months ago
CC:
reviews_dartlang.org
Target Ref:
refs/heads/master
Visibility:
Public.

Description

Decouple TypeMask from ClassElement - by typing FlatTypeMask.base with Entity - moving needsNoSuchMethodHandling to ClosedWorld - and testing needsNoSuchMethodHandling R=sigmund@google.com Committed: https://github.com/dart-lang/sdk/commit/74b74a13f70dac3fab2bf1df164e94d9371f5f41

Patch Set 1 #

Total comments: 14

Patch Set 2 : Updated cf. comments. #

Unified diffs Side-by-side diffs Delta from patch set Stats (+528 lines, -210 lines) Patch
M pkg/compiler/lib/src/types/flat_type_mask.dart View 1 14 chunks +48 lines, -158 lines 0 comments Download
M pkg/compiler/lib/src/types/forwarding_type_mask.dart View 1 chunk +6 lines, -6 lines 0 comments Download
M pkg/compiler/lib/src/types/masks.dart View 1 1 chunk +1 line, -1 line 0 comments Download
M pkg/compiler/lib/src/types/type_mask.dart View 6 chunks +20 lines, -23 lines 0 comments Download
M pkg/compiler/lib/src/types/union_type_mask.dart View 3 chunks +11 lines, -12 lines 0 comments Download
M pkg/compiler/lib/src/world.dart View 1 9 chunks +149 lines, -10 lines 0 comments Download
A tests/compiler/dart2js/needs_no_such_method_test.dart View 1 1 chunk +293 lines, -0 lines 0 comments Download

Messages

Total messages: 6 (2 generated)
Johnni Winther
4 years, 2 months ago (2016-10-14 12:08:58 UTC) #2
Siggi Cherem (dart-lang)
lgtm! https://codereview.chromium.org/2420073002/diff/1/pkg/compiler/lib/src/types/flat_type_mask.dart File pkg/compiler/lib/src/types/flat_type_mask.dart (right): https://codereview.chromium.org/2420073002/diff/1/pkg/compiler/lib/src/types/flat_type_mask.dart#newcode39 pkg/compiler/lib/src/types/flat_type_mask.dart:39: bool _validateBase(Element element) => element.isDeclaration; do we want ...
4 years, 2 months ago (2016-10-14 16:49:57 UTC) #3
Johnni Winther
Committed patchset #2 (id:20001) manually as 74b74a13f70dac3fab2bf1df164e94d9371f5f41 (presubmit successful).
4 years, 2 months ago (2016-10-17 07:47:28 UTC) #5
Johnni Winther
4 years, 2 months ago (2016-10-17 07:57:40 UTC) #6
Message was sent while issue was closed.
https://codereview.chromium.org/2420073002/diff/1/pkg/compiler/lib/src/types/...
File pkg/compiler/lib/src/types/flat_type_mask.dart (right):

https://codereview.chromium.org/2420073002/diff/1/pkg/compiler/lib/src/types/...
pkg/compiler/lib/src/types/flat_type_mask.dart:39: bool _validateBase(Element
element) => element.isDeclaration;
On 2016/10/14 16:49:57, Siggi Cherem (dart-lang) wrote:
> do we want to validate also that it is a ClassElement not just an Element?

Done. I just wanted to remove all mentioning of ClassElement but function is
temporary anyway. The ClosedWorld should probably create the valid base entity.

https://codereview.chromium.org/2420073002/diff/1/pkg/compiler/lib/src/types/...
pkg/compiler/lib/src/types/flat_type_mask.dart:582: ClassElement enclosing =
result.enclosingClass.declaration;
On 2016/10/14 16:49:57, Siggi Cherem (dart-lang) wrote:
> what do you get in enclosingClass when it is not a declaration here? 

If target is an injected member (non-patch member in a patch class) enclosing
would be the implementation and _not_ the declaration element.

https://codereview.chromium.org/2420073002/diff/1/pkg/compiler/lib/src/world....
File pkg/compiler/lib/src/world.dart (right):

https://codereview.chromium.org/2420073002/diff/1/pkg/compiler/lib/src/world....
pkg/compiler/lib/src/world.dart:332: }
On 2016/10/14 16:49:57, Siggi Cherem (dart-lang) wrote:
> we can also replace the 3 lines above with:
> 
>   var cachedMasks = _canonicalizedTypeMasks[flags] ??= <ClassElement,
> TypeMask>{};
> 
> or combine with the one below:
> 
>   return (_canonicalizedTypeMasks[flags] ??= <ClassElement, TypeMask>{})
>       .putIfAbsent(base, createMask);

Done(-ish).

https://codereview.chromium.org/2420073002/diff/1/pkg/compiler/lib/src/world....
pkg/compiler/lib/src/world.dart:334: base, () => new FlatTypeMask.internal(base,
flags));
On 2016/10/14 16:49:57, Siggi Cherem (dart-lang) wrote:
> use createMask here

Done.

https://codereview.chromium.org/2420073002/diff/1/pkg/compiler/lib/src/world....
pkg/compiler/lib/src/world.dart:697: current = current.superclass;
On 2016/10/14 16:49:57, Siggi Cherem (dart-lang) wrote:
> I assume we don't need to assert that superclass is a declaration, correct?

Correct.

https://codereview.chromium.org/2420073002/diff/1/pkg/compiler/lib/src/world....
pkg/compiler/lib/src/world.dart:1144: enum ClassMask {
On 2016/10/14 16:49:57, Siggi Cherem (dart-lang) wrote:
> I'm not convinced about adding this enum. Since it is only used in one query,
> what if we remove the enum and use a couple boolean named arguments there? For
> example:
> 
>   bool needsNoSuchMethod(ClassElement cls, Selector selector,
>      {includeSubclasses: false, includeSubtypes: false});
> 
> If we want to have the enum, I'd suggest to rename it to `ClassQuery` or
> something else (the word Mask seems to be there only because it is coupled
> somehow with TypeMask)

Renamed to `ClassQuery`. We'll need it more function moved from xTypeMask to
ClosedWorld.

https://codereview.chromium.org/2420073002/diff/1/tests/compiler/dart2js/need...
File tests/compiler/dart2js/needs_no_such_method_test.dart (right):

https://codereview.chromium.org/2420073002/diff/1/tests/compiler/dart2js/need...
tests/compiler/dart2js/needs_no_such_method_test.dart:37: ClassElement
Superclass, Subclass, Subtype;
On 2016/10/14 16:49:57, Siggi Cherem (dart-lang) wrote:
> nit: I'm torn on this, I think I'm leaning towards renaming to use lower-case
> variable names

Done.

Powered by Google App Engine
This is Rietveld 408576698