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

Unified Diff: pkg/compiler/lib/src/js_model/elements.dart

Issue 2970943002: Use index in J/KTypeVariable and fix remaining inequivalence (Closed)
Patch Set: Fix 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
« no previous file with comments | « pkg/compiler/lib/src/js_backend/backend.dart ('k') | pkg/compiler/lib/src/kernel/element_map_impl.dart » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: pkg/compiler/lib/src/js_model/elements.dart
diff --git a/pkg/compiler/lib/src/js_model/elements.dart b/pkg/compiler/lib/src/js_model/elements.dart
index e04c1b24097b2ec84374770d9cc5592a32c40100..4de3aa76f2efbe1a4bd91d5980e511042c546c01 100644
--- a/pkg/compiler/lib/src/js_model/elements.dart
+++ b/pkg/compiler/lib/src/js_model/elements.dart
@@ -61,36 +61,8 @@ abstract class JsToFrontendMapBase implements JsToFrontendMap {
return typeVariable;
}
- final Map<TypeVariableEntity, TypeVariableEntity> _toBackendTypeVariableMap =
- <TypeVariableEntity, TypeVariableEntity>{};
-
- final Map<TypeVariableEntity, TypeVariableEntity> _toFrontendTypeVariableMap =
- <TypeVariableEntity, TypeVariableEntity>{};
-
- TypeVariableEntity toBackendTypeVariable(TypeVariableEntity typeVariable) {
- return _toBackendTypeVariableMap.putIfAbsent(typeVariable, () {
- Entity typeDeclaration;
- if (typeVariable.typeDeclaration is ClassEntity) {
- typeDeclaration = toBackendClass(typeVariable.typeDeclaration);
- } else {
- typeDeclaration = toBackendMember(typeVariable.typeDeclaration);
- }
- TypeVariableEntity newTypeVariable =
- createTypeVariable(typeDeclaration, typeVariable);
- _toFrontendTypeVariableMap[newTypeVariable] = typeVariable;
- return newTypeVariable;
- });
- }
-
- TypeVariableEntity toFrontendTypeVariable(TypeVariableEntity typeVariable) {
- return _toFrontendTypeVariableMap[typeVariable];
- }
-
- TypeVariableEntity createTypeVariable(
- Entity typeDeclaration, TypeVariableEntity typeVariable) {
- return new JTypeVariable(
- typeDeclaration, typeVariable.name, typeVariable.index);
- }
+ TypeVariableEntity toBackendTypeVariable(TypeVariableEntity typeVariable);
+ TypeVariableEntity toFrontendTypeVariable(TypeVariableEntity typeVariable);
}
class JsElementCreatorMixin {
@@ -105,8 +77,8 @@ class JsElementCreatorMixin {
}
TypeVariableEntity createTypeVariable(
- Entity typeDeclaration, String name, int index) {
- return new JTypeVariable(typeDeclaration, name, index);
+ int typeVariableIndex, Entity typeDeclaration, String name, int index) {
+ return new JTypeVariable(typeVariableIndex, typeDeclaration, name, index);
}
IndexedConstructor createGenerativeConstructor(
@@ -507,11 +479,13 @@ class JField extends JMember implements FieldEntity, IndexedField {
}
class JTypeVariable implements TypeVariableEntity, IndexedTypeVariable {
+ final int typeVariableIndex;
final Entity typeDeclaration;
final String name;
final int index;
- JTypeVariable(this.typeDeclaration, this.name, this.index);
+ JTypeVariable(
+ this.typeVariableIndex, this.typeDeclaration, this.name, this.index);
String toString() =>
'${jsElementPrefix}type_variable(${typeDeclaration.name}.$name)';
« no previous file with comments | « pkg/compiler/lib/src/js_backend/backend.dart ('k') | pkg/compiler/lib/src/kernel/element_map_impl.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698