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

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

Issue 1413543004: Extract WorldImpactBuilder from _ResolutionWorldImpact. (Closed) Base URL: https://github.com/dart-lang/sdk.git@master
Patch Set: Created 5 years, 2 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « pkg/compiler/lib/src/resolution/registry.dart ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: pkg/compiler/lib/src/universe/world_impact.dart
diff --git a/pkg/compiler/lib/src/universe/world_impact.dart b/pkg/compiler/lib/src/universe/world_impact.dart
index 263ba2a921b635d4f05640fd1680bc2382c0f150..50cb902976812fc42c8d3cfb702f0a0a542b4def 100644
--- a/pkg/compiler/lib/src/universe/world_impact.dart
+++ b/pkg/compiler/lib/src/universe/world_impact.dart
@@ -11,6 +11,9 @@ import '../elements/elements.dart' show
Element,
LocalFunctionElement,
MethodElement;
+import '../util/util.dart' show
+ Setlet;
+
import 'universe.dart' show
UniverseSelector;
@@ -68,3 +71,157 @@ class WorldImpact {
return sb.toString();
}
}
+
+class WorldImpactBuilder {
+ // TODO(johnniwinther): Do we benefit from lazy initialization of the
+ // [Setlet]s?
+ Setlet<UniverseSelector> _dynamicInvocations;
+ Setlet<UniverseSelector> _dynamicGetters;
+ Setlet<UniverseSelector> _dynamicSetters;
+ Setlet<InterfaceType> _instantiatedTypes;
+ Setlet<Element> _staticUses;
+ Setlet<DartType> _isChecks;
+ Setlet<DartType> _asCasts;
+ Setlet<DartType> _checkedModeChecks;
+ Setlet<MethodElement> _closurizedFunctions;
+ Setlet<LocalFunctionElement> _closures;
+ Setlet<DartType> _typeLiterals;
+
+ void registerDynamicGetter(UniverseSelector selector) {
+ assert(selector != null);
+ if (_dynamicGetters == null) {
+ _dynamicGetters = new Setlet<UniverseSelector>();
+ }
+ _dynamicGetters.add(selector);
+ }
+
+ Iterable<UniverseSelector> get dynamicGetters {
+ return _dynamicGetters != null
+ ? _dynamicGetters : const <UniverseSelector>[];
+ }
+
+ void registerDynamicInvocation(UniverseSelector selector) {
+ assert(selector != null);
+ if (_dynamicInvocations == null) {
+ _dynamicInvocations = new Setlet<UniverseSelector>();
+ }
+ _dynamicInvocations.add(selector);
+ }
+
+ Iterable<UniverseSelector> get dynamicInvocations {
+ return _dynamicInvocations != null
+ ? _dynamicInvocations : const <UniverseSelector>[];
+ }
+
+ void registerDynamicSetter(UniverseSelector selector) {
+ assert(selector != null);
+ if (_dynamicSetters == null) {
+ _dynamicSetters = new Setlet<UniverseSelector>();
+ }
+ _dynamicSetters.add(selector);
+ }
+
+ Iterable<UniverseSelector> get dynamicSetters {
+ return _dynamicSetters != null
+ ? _dynamicSetters : const <UniverseSelector>[];
+ }
+
+ void registerInstantiatedType(InterfaceType type) {
+ assert(type != null);
+ if (_instantiatedTypes == null) {
+ _instantiatedTypes = new Setlet<InterfaceType>();
+ }
+ _instantiatedTypes.add(type);
+ }
+
+ Iterable<InterfaceType> get instantiatedTypes {
+ return _instantiatedTypes != null
+ ? _instantiatedTypes : const <InterfaceType>[];
+ }
+
+ void registerTypeLiteral(DartType type) {
+ assert(type != null);
+ if (_typeLiterals == null) {
+ _typeLiterals = new Setlet<DartType>();
+ }
+ _typeLiterals.add(type);
+ }
+
+ Iterable<DartType> get typeLiterals {
+ return _typeLiterals != null
+ ? _typeLiterals : const <DartType>[];
+ }
+
+ void registerStaticUse(Element element) {
+ assert(element != null);
+ if (_staticUses == null) {
+ _staticUses = new Setlet<Element>();
+ }
+ _staticUses.add(element);
+ }
+
+ Iterable<Element> get staticUses {
+ return _staticUses != null ? _staticUses : const <Element>[];
+ }
+
+ void registerIsCheck(DartType type) {
+ assert(type != null);
+ if (_isChecks == null) {
+ _isChecks = new Setlet<DartType>();
+ }
+ _isChecks.add(type);
+ }
+
+ Iterable<DartType> get isChecks {
+ return _isChecks != null
+ ? _isChecks : const <DartType>[];
+ }
+
+ void registerAsCast(DartType type) {
+ if (_asCasts == null) {
+ _asCasts = new Setlet<DartType>();
+ }
+ _asCasts.add(type);
+ }
+
+ Iterable<DartType> get asCasts {
+ return _asCasts != null
+ ? _asCasts : const <DartType>[];
+ }
+
+ void registerCheckedModeCheckedType(DartType type) {
+ if (_checkedModeChecks == null) {
+ _checkedModeChecks = new Setlet<DartType>();
+ }
+ _checkedModeChecks.add(type);
+ }
+
+ Iterable<DartType> get checkedModeChecks {
+ return _checkedModeChecks != null
+ ? _checkedModeChecks : const <DartType>[];
+ }
+
+ void registerClosurizedFunction(MethodElement element) {
+ if (_closurizedFunctions == null) {
+ _closurizedFunctions = new Setlet<MethodElement>();
+ }
+ _closurizedFunctions.add(element);
+ }
+
+ Iterable<MethodElement> get closurizedFunctions {
+ return _closurizedFunctions != null
+ ? _closurizedFunctions : const <MethodElement>[];
+ }
+
+ void registerClosure(LocalFunctionElement element) {
+ if (_closures == null) {
+ _closures = new Setlet<LocalFunctionElement>();
+ }
+ _closures.add(element);
+ }
+
+ Iterable<LocalFunctionElement> get closures {
+ return _closures != null
+ ? _closures : const <LocalFunctionElement>[];
+ }
+}
« no previous file with comments | « pkg/compiler/lib/src/resolution/registry.dart ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698