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

Unified Diff: pkg/compiler/lib/src/serialization/equivalence.dart

Issue 2017903002: Improve equivalence testing of unnamed mixin applications. (Closed) Base URL: https://github.com/dart-lang/sdk.git@master
Patch Set: Updated cf. comments. Created 4 years, 7 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/serialization/equivalence.dart
diff --git a/pkg/compiler/lib/src/serialization/equivalence.dart b/pkg/compiler/lib/src/serialization/equivalence.dart
index ab8f78e8931f8846917412faf186fc7c76fbd40a..c7653ef4f6c9ac500bb9cbeef4d2a3c8356e8df3 100644
--- a/pkg/compiler/lib/src/serialization/equivalence.dart
+++ b/pkg/compiler/lib/src/serialization/equivalence.dart
@@ -383,9 +383,28 @@ class ElementIdentityEquivalence extends BaseElementVisitor<bool, Element> {
@override
bool visitClassElement(ClassElement element1, ClassElement element2) {
- return strategy.test(
- element1, element2, 'name', element1.name, element2.name) &&
- visit(element1.library, element2.library);
+ if (!strategy.test(element1, element2, 'isUnnamedMixinApplication',
+ element1.isUnnamedMixinApplication,
+ element2.isUnnamedMixinApplication)) {
+ return false;
+ }
+ if (element1.isUnnamedMixinApplication) {
+ MixinApplicationElement mixin1 = element1;
+ MixinApplicationElement mixin2 = element2;
+ return strategy.testElements(mixin1, mixin2, 'subclass',
+ mixin1.subclass, mixin2.subclass) &&
+ // Using the [mixinType] is more precise but requires the test to
+ // handle self references: The identity of a type variable is based on
+ // its type declaration and if [mixin1] is generic the [mixinType]
+ // will contain the type variables declared by [mixin1], i.e.
+ // `abstract class Mixin<T> implements MixinType<T> {}`
+ strategy.testElements(mixin1, mixin2, 'mixin',
+ mixin1.mixin, mixin2.mixin);
+ } else {
+ return strategy.test(
+ element1, element2, 'name', element1.name, element2.name) &&
+ visit(element1.library, element2.library);
+ }
}
bool checkMembers(Element element1, Element element2) {
« no previous file with comments | « pkg/compiler/lib/src/resolution/class_hierarchy.dart ('k') | pkg/compiler/lib/src/serialization/modelz.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698