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

Unified Diff: pkg/compiler/lib/src/js_emitter/runtime_type_generator.dart

Issue 2299783002: dart2js: Fix some problems with mixins and generics (Closed)
Patch Set: Created 4 years, 4 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/runtime_types.dart ('k') | tests/language/language_dart2js.status » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: pkg/compiler/lib/src/js_emitter/runtime_type_generator.dart
diff --git a/pkg/compiler/lib/src/js_emitter/runtime_type_generator.dart b/pkg/compiler/lib/src/js_emitter/runtime_type_generator.dart
index 16ada26bf3693b0fc94edc5630d3698a39a9d316..ffe0e87d9f14637ec757ece109a2e43ee295357d 100644
--- a/pkg/compiler/lib/src/js_emitter/runtime_type_generator.dart
+++ b/pkg/compiler/lib/src/js_emitter/runtime_type_generator.dart
@@ -41,6 +41,8 @@ class RuntimeTypeGenerator {
Iterable<ClassElement> get classesUsingTypeVariableTests =>
typeTestRegistry.classesUsingTypeVariableTests;
+ Iterable<ClassElement> get classesUsingTypeVariableExpression =>
+ backend.rti.classesUsingTypeVariableExpression;
Set<FunctionType> get checkedFunctionTypes =>
typeTestRegistry.checkedFunctionTypes;
@@ -186,6 +188,8 @@ class RuntimeTypeGenerator {
return backend.rti.isTrivialSubstitution(a, b);
}
+ bool supertypesNeedSubstitutions = false;
+
if (superclass != null &&
superclass != coreClasses.objectClass &&
!haveSameTypeVariables(cls, superclass)) {
@@ -203,11 +207,20 @@ class RuntimeTypeGenerator {
}
superclass = superclass.superclass;
}
+ supertypesNeedSubstitutions = true;
+ }
+
+ if (cls is MixinApplicationElement) {
+ supertypesNeedSubstitutions = true;
+ }
+
+ if (supertypesNeedSubstitutions) {
for (DartType supertype in cls.allSupertypes) {
ClassElement superclass = supertype.element;
if (generated.contains(superclass)) continue;
if (classesUsingTypeVariableTests.contains(superclass) ||
+ classesUsingTypeVariableExpression.contains(superclass) ||
checkedClasses.contains(superclass)) {
// Generate substitution. If no substitution is necessary, emit
// `null` to overwrite a (possibly) existing substitution from the
@@ -217,7 +230,6 @@ class RuntimeTypeGenerator {
}
void emitNothing(_, {emitNull}) {}
- ;
generateSubstitution = emitNothing;
}
@@ -266,8 +278,6 @@ class RuntimeTypeGenerator {
}
}
- ;
-
tryEmitTest(cls);
for (DartType interfaceType in cls.interfaces) {
« no previous file with comments | « pkg/compiler/lib/src/js_backend/runtime_types.dart ('k') | tests/language/language_dart2js.status » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698