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

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

Issue 2580403002: Extract ClosedWorldImpl from WorldImpl. (Closed)
Patch Set: Created 4 years 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
Index: pkg/compiler/lib/src/universe/world_builder.dart
diff --git a/pkg/compiler/lib/src/universe/world_builder.dart b/pkg/compiler/lib/src/universe/world_builder.dart
index cd676bdc659516be8858ced85e430770d49e5009..eebb1de01608ad2109f3e0fa88c5c9c19c360552 100644
--- a/pkg/compiler/lib/src/universe/world_builder.dart
+++ b/pkg/compiler/lib/src/universe/world_builder.dart
@@ -109,6 +109,39 @@ abstract class SelectorConstraintsStrategy {
UniverseSelectorConstraints createSelectorConstraints(Selector selector);
}
+class OpenWorldStrategy implements SelectorConstraintsStrategy {
+ const OpenWorldStrategy();
+
+ OpenWorldConstraints createSelectorConstraints(Selector selector) {
+ return new OpenWorldConstraints();
+ }
+}
+
+class OpenWorldConstraints extends UniverseSelectorConstraints {
+ bool isAll = false;
+
+ @override
+ bool applies(Element element, Selector selector, World world) => isAll;
+
+ @override
+ bool needsNoSuchMethodHandling(Selector selector, World world) => isAll;
+
+ @override
+ bool addReceiverConstraint(ReceiverConstraint constraint) {
+ if (isAll) return false;
+ isAll = true;
+ return true;
+ }
+
+ String toString() {
+ if (isAll) {
+ return '<all>';
+ } else {
+ return '<none>';
+ }
+ }
+}
+
/// The [WorldBuilder] is an auxiliary class used in the process of computing
/// the [ClosedWorld].
// TODO(johnniwinther): Move common implementation to a [WorldBuilderBase] when
@@ -453,7 +486,7 @@ class ResolutionWorldBuilderImpl implements ResolutionWorldBuilder {
throw new SpannableAssertionFailure(
NO_LOCATION_SPANNABLE, "The world builder has not yet been closed.");
}
- return _openWorld;
+ return _openWorld.closedWorldCache;
}
/// All directly instantiated classes, that is, classes with a generative

Powered by Google App Engine
This is Rietveld 408576698