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

Unified Diff: pkg/compiler/lib/src/kernel/env.dart

Issue 2971673002: Split ClassEnv into env and data to avoid copying types/constants from the k-model (Closed)
Patch Set: Created 3 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
Index: pkg/compiler/lib/src/kernel/env.dart
diff --git a/pkg/compiler/lib/src/kernel/env.dart b/pkg/compiler/lib/src/kernel/env.dart
index c0185a45434ac3be54037621559f494c51983413..fbd39acb672d7b58f21118fc58396ef031905768 100644
--- a/pkg/compiler/lib/src/kernel/env.dart
+++ b/pkg/compiler/lib/src/kernel/env.dart
@@ -157,22 +157,12 @@ class LibraryEnv {
/// Environment for fast lookup of class members.
class ClassEnv {
final ir.Class cls;
- bool isMixinApplication;
final bool isUnnamedMixinApplication;
Siggi Cherem (dart-lang) 2017/07/05 20:19:01 this feels like it belongs in data too
Johnni Winther 2017/07/06 13:36:38 It should actually be a property of `ir.Class`. It
- InterfaceType thisType;
- InterfaceType rawType;
- InterfaceType supertype;
- InterfaceType mixedInType;
- List<InterfaceType> interfaces;
- OrderedTypeSet orderedTypeSet;
-
Map<String, ir.Member> _constructorMap;
Map<String, ir.Member> _memberMap;
Map<String, ir.Member> _setterMap;
- Iterable<ConstantValue> _metadata;
-
ClassEnv(this.cls)
// TODO(johnniwinther): Change this to use a property on [cls] when such
// is added to kernel.
@@ -313,10 +303,30 @@ class ClassEnv {
_ensureMaps();
_constructorMap.values.forEach(f);
}
+}
+
+class ClassData {
+ final ir.Class cls;
+ bool isMixinApplication;
+
+ InterfaceType thisType;
+ InterfaceType rawType;
+ InterfaceType supertype;
+ InterfaceType mixedInType;
+ List<InterfaceType> interfaces;
+ OrderedTypeSet orderedTypeSet;
+
+ Iterable<ConstantValue> _metadata;
+
+ ClassData(this.cls);
Iterable<ConstantValue> getMetadata(KernelToElementMapBase elementMap) {
return _metadata ??= elementMap.getMetadata(cls.annotations);
}
+
+ ClassData copy() {
+ return new ClassData(cls);
+ }
}
class MemberData {
@@ -332,6 +342,10 @@ class MemberData {
Iterable<ConstantValue> getMetadata(KernelToElementMapBase elementMap) {
return _metadata ??= elementMap.getMetadata(node.annotations);
}
+
+ MemberData copy() {
+ return new MemberData(node);
+ }
}
class FunctionData extends MemberData {
@@ -368,6 +382,11 @@ class FunctionData extends MemberData {
..sort(namedOrdering)
..forEach(handleParameter);
}
+
+ @override
+ FunctionData copy() {
+ return new FunctionData(node, functionNode);
+ }
}
class ConstructorData extends FunctionData {
@@ -391,6 +410,11 @@ class ConstructorData extends FunctionData {
}
return _constantConstructor;
}
+
+ @override
+ ConstructorData copy() {
+ return new ConstructorData(node, functionNode);
+ }
}
class FieldData extends MemberData {
@@ -414,4 +438,9 @@ class FieldData extends MemberData {
}
return _constant;
}
+
+ @override
+ FieldData copy() {
+ return new FieldData(node);
+ }
}

Powered by Google App Engine
This is Rietveld 408576698