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

Unified Diff: pkg/compiler/lib/src/resolution/tree_elements.dart

Issue 1245583002: Deferred loading track type-dependencies for is, as and type-annotations. (Closed) Base URL: https://github.com/dart-lang/sdk.git@master
Patch Set: Created 5 years, 5 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') | tests/language/deferred_type_dependency_lib1.dart » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: pkg/compiler/lib/src/resolution/tree_elements.dart
diff --git a/pkg/compiler/lib/src/resolution/tree_elements.dart b/pkg/compiler/lib/src/resolution/tree_elements.dart
index 48c54308e93bd8463a50aa2089cee6aa9c1a2ff2..e4dfb1e8db9b8281aa93875ce6256778e4522e48 100644
--- a/pkg/compiler/lib/src/resolution/tree_elements.dart
+++ b/pkg/compiler/lib/src/resolution/tree_elements.dart
@@ -12,8 +12,12 @@ abstract class TreeElements {
/// [analyzedElement].
Iterable<Element> get allElements;
+ /// The set of types that this TreeElement depends on.
+ /// This includes instantiated types, types in is-checks and as-expressions
+ /// and in checked mode the types of all type-annotations.
+ Iterable<DartType> get requiredTypes;
+
void forEachConstantNode(f(Node n, ConstantExpression c));
- void forEachType(f(Node n, DartType t));
/// A set of additional dependencies. See [registerDependency] below.
Iterable<Element> get otherDependencies;
@@ -71,6 +75,9 @@ abstract class TreeElements {
/// For example, elements that are used by a backend.
void registerDependency(Element element);
+ /// Register a dependency on [type].
+ void addRequiredType(DartType type);
+
/// Returns a list of nodes that potentially mutate [element] anywhere in its
/// scope.
List<Node> getPotentialMutations(VariableElement element);
@@ -112,6 +119,7 @@ class TreeElementMapping extends TreeElements {
Setlet<Element> _elements;
Setlet<Send> _asserts;
Maplet<Send, SendStructure> _sendStructureMap;
+ Setlet<DartType> _requiredTypes;
/// Map from nodes to the targets they define.
Map<Node, JumpTarget> _definedTargets;
@@ -175,9 +183,16 @@ class TreeElementMapping extends TreeElements {
DartType getType(Node node) => _types != null ? _types[node] : null;
- void forEachType(f(Node n, DartType t)) {
- if (_types != null) {
- _types.forEach(f);
+ void addRequiredType(DartType type) {
+ if (_requiredTypes == null) _requiredTypes = new Setlet<DartType>();
+ _requiredTypes.add(type);
+ }
+
+ Iterable<DartType> get requiredTypes {
+ if (_requiredTypes == null) {
+ return const <DartType>[];
+ } else {
+ return _requiredTypes;
}
}
« no previous file with comments | « pkg/compiler/lib/src/resolution/registry.dart ('k') | tests/language/deferred_type_dependency_lib1.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698