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

Side by Side Diff: pkg/compiler/lib/src/universe/member_usage.dart

Issue 2913713004: Add model test of CodegenWorldBuilder to compile_from_dill_test (Closed)
Patch Set: Created 3 years, 6 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
OLDNEW
1 // Copyright (c) 2017, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2017, 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 part of world_builder; 5 part of world_builder;
6 6
7 abstract class _AbstractUsage<T> { 7 abstract class _AbstractUsage<T> {
8 final EnumSet<T> _pendingUse = new EnumSet<T>(); 8 final EnumSet<T> _pendingUse = new EnumSet<T>();
9 9
10 _AbstractUsage() { 10 _AbstractUsage() {
11 _pendingUse.addAll(_originalUse); 11 _pendingUse.addAll(_originalUse);
12 } 12 }
13 13
14 /// Returns the possible uses of [entity] that have not yet been registered. 14 /// Returns the possible uses of [entity] that have not yet been registered.
15 EnumSet<T> get pendingUse => _pendingUse; 15 EnumSet<T> get pendingUse => _pendingUse;
16 16
17 /// Returns the uses of [entity] that have been registered. 17 /// Returns the uses of [entity] that have been registered.
18 EnumSet<T> get appliedUse => _originalUse.minus(_pendingUse); 18 EnumSet<T> get appliedUse => _originalUse.minus(_pendingUse);
19 19
20 EnumSet<T> get _originalUse; 20 EnumSet<T> get _originalUse;
21 21
22 /// `true` if the [appliedUse] is non-empty. 22 /// `true` if the [appliedUse] is non-empty.
23 bool get hasUse => appliedUse.isNotEmpty; 23 bool get hasUse => appliedUse.isNotEmpty;
24
25 int get hashCode => _originalUse.hashCode * 13 + _pendingUse.hashCode * 17;
26
27 bool operator ==(other) {
28 if (identical(this, other)) return true;
29 if (other is! _AbstractUsage) return false;
30 return _originalUse.value == other._originalUse.value &&
31 _pendingUse.value == other._pendingUse.value;
32 }
24 } 33 }
25 34
26 /// Registry for the observed use of a member [entity] in the open world. 35 /// Registry for the observed use of a member [entity] in the open world.
27 abstract class _MemberUsage extends _AbstractUsage<MemberUse> { 36 abstract class _MemberUsage extends _AbstractUsage<MemberUse> {
28 // TODO(johnniwinther): Change [Entity] to [MemberEntity]. 37 // TODO(johnniwinther): Change [Entity] to [MemberEntity].
29 final Entity entity; 38 final Entity entity;
30 39
31 _MemberUsage.internal(this.entity); 40 _MemberUsage.internal(this.entity);
32 41
33 factory _MemberUsage(MemberEntity member, {bool isNative: false}) { 42 factory _MemberUsage(MemberEntity member, {bool isNative: false}) {
(...skipping 338 matching lines...) Expand 10 before | Expand all | Expand 10 after
372 if (hasClosurization) { 381 if (hasClosurization) {
373 return MemberUses.NONE; 382 return MemberUses.NONE;
374 } 383 }
375 hasNormalUse = hasClosurization = true; 384 hasNormalUse = hasClosurization = true;
376 return _pendingUse.removeAll(MemberUses.ALL_STATIC); 385 return _pendingUse.removeAll(MemberUses.ALL_STATIC);
377 } 386 }
378 387
379 @override 388 @override
380 EnumSet<MemberUse> get _originalUse => MemberUses.ALL_STATIC; 389 EnumSet<MemberUse> get _originalUse => MemberUses.ALL_STATIC;
381 } 390 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698