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

Unified Diff: pkg/compiler/lib/src/universe/universe.dart

Issue 1408383006: Rename UniverseSelector to DynamicUse and move it to use.dart (Closed) Base URL: https://github.com/dart-lang/sdk.git@master
Patch Set: Updated cf. comments. Created 5 years, 1 month 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « pkg/compiler/lib/src/ssa/ssa.dart ('k') | pkg/compiler/lib/src/universe/use.dart » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: pkg/compiler/lib/src/universe/universe.dart
diff --git a/pkg/compiler/lib/src/universe/universe.dart b/pkg/compiler/lib/src/universe/universe.dart
index 79d3cd90f749c9242c66fe8db79b81cfbc665cde..5f9fd4632487d19bd496ee8ea7d03e65a56f5380 100644
--- a/pkg/compiler/lib/src/universe/universe.dart
+++ b/pkg/compiler/lib/src/universe/universe.dart
@@ -19,48 +19,11 @@ import '../world.dart' show
import 'selector.dart' show
Selector;
import 'use.dart' show
+ DynamicUse,
+ DynamicUseKind,
StaticUse,
StaticUseKind;
-enum DynamicUseKind {
- INVOKE,
- GET,
- SET,
-}
-
-// TODO(johnniwinther): Rename to `DynamicUse` and move to 'use.dart'.
-class UniverseSelector {
- final Selector selector;
- final ReceiverConstraint mask;
-
- UniverseSelector(this.selector, this.mask);
-
- bool appliesUnnamed(Element element, ClassWorld world) {
- return selector.appliesUnnamed(element, world) &&
- (mask == null || mask.canHit(element, selector, world));
- }
-
- DynamicUseKind get kind {
- if (selector.isGetter) {
- return DynamicUseKind.GET;
- } else if (selector.isSetter) {
- return DynamicUseKind.SET;
- } else {
- return DynamicUseKind.INVOKE;
- }
- }
-
- int get hashCode => selector.hashCode * 13 + mask.hashCode * 17;
-
- bool operator ==(other) {
- if (identical(this, other)) return true;
- if (other is! UniverseSelector) return false;
- return selector == other.selector && mask == other.mask;
- }
-
- String toString() => '$selector,$mask';
-}
-
/// The known constraint on receiver for a dynamic call site.
///
/// This can for instance be used to constrain this dynamic call to `foo` to
@@ -343,23 +306,23 @@ class Universe {
return _hasMatchingSelector(_invokedSetters[member.name], member, world);
}
- bool registerDynamicUse(UniverseSelector selector) {
- switch (selector.kind) {
+ bool registerDynamicUse(DynamicUse dynamicUse) {
+ switch (dynamicUse.kind) {
case DynamicUseKind.INVOKE:
- return _registerNewSelector(selector, _invokedNames);
+ return _registerNewSelector(dynamicUse, _invokedNames);
case DynamicUseKind.GET:
- return _registerNewSelector(selector, _invokedGetters);
+ return _registerNewSelector(dynamicUse, _invokedGetters);
case DynamicUseKind.SET:
- return _registerNewSelector(selector, _invokedSetters);
+ return _registerNewSelector(dynamicUse, _invokedSetters);
}
}
bool _registerNewSelector(
- UniverseSelector universeSelector,
+ DynamicUse dynamicUse,
Map<String, Map<Selector, SelectorConstraints>> selectorMap) {
- Selector selector = universeSelector.selector;
+ Selector selector = dynamicUse.selector;
String name = selector.name;
- ReceiverConstraint mask = universeSelector.mask;
+ ReceiverConstraint mask = dynamicUse.mask;
Map<Selector, SelectorConstraints> selectors = selectorMap.putIfAbsent(
name, () => new Maplet<Selector, SelectorConstraints>());
UniverseSelectorConstraints constraints = selectors.putIfAbsent(
« no previous file with comments | « pkg/compiler/lib/src/ssa/ssa.dart ('k') | pkg/compiler/lib/src/universe/use.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698