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

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

Issue 2874973003: Add more equivalence tests for ElementEnvironment (Closed)
Patch Set: Created 3 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
« no previous file with comments | « pkg/compiler/lib/src/kernel/kernel.dart ('k') | tests/compiler/dart2js/kernel/closed_world2_test.dart » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 73e79f76bd71453cd6467e3339e4055228874e30..57c5eca1e8055b2544e1c3e7d18693c93a8ac70f 100644
--- a/pkg/compiler/lib/src/serialization/equivalence.dart
+++ b/pkg/compiler/lib/src/serialization/equivalence.dart
@@ -78,7 +78,7 @@ bool areMapsEquivalent(Map map1, Map map2,
for (var key1 in map1.keys) {
bool found = false;
for (var key2 in map2.keys) {
- if (keyEquivalence(key2, key2)) {
+ if (keyEquivalence(key1, key2)) {
Siggi Cherem (dart-lang) 2017/05/11 19:12:24 maybe we need tests for the equivalent checks :)
Johnni Winther 2017/05/12 08:11:25 ;)
found = true;
remaining.remove(key2);
if (!valueEquivalence(map1[key1], map2[key2])) {
@@ -914,16 +914,15 @@ class ConstantValueEquivalence
@override
bool visitConstructed(
ConstructedConstantValue value1, ConstructedConstantValue value2) {
- ResolutionInterfaceType type1 = value1.type;
- ResolutionInterfaceType type2 = value2.type;
- return strategy.testTypes(value1, value2, 'type', type1, type2) &&
+ return strategy.testTypes(
+ value1, value2, 'type', value1.type, value2.type) &&
strategy.testMaps(
value1,
value2,
'fields',
value1.fields,
value2.fields,
- areElementsEquivalent,
+ strategy.elementEquivalence,
(a, b) => strategy.testConstantValues(
value1, value2, 'fields.values', a, b));
}
@@ -931,25 +930,22 @@ class ConstantValueEquivalence
@override
bool visitFunction(
FunctionConstantValue value1, FunctionConstantValue value2) {
- MethodElement method1 = value1.element;
- MethodElement method2 = value2.element;
- return strategy.testElements(value1, value2, 'element', method1, method2);
+ return strategy.testElements(
+ value1, value2, 'element', value1.element, value2.element);
}
@override
bool visitList(ListConstantValue value1, ListConstantValue value2) {
- ResolutionInterfaceType type1 = value1.type;
- ResolutionInterfaceType type2 = value2.type;
- return strategy.testTypes(value1, value2, 'type', type1, type2) &&
+ return strategy.testTypes(
+ value1, value2, 'type', value1.type, value2.type) &&
strategy.testConstantValueLists(
value1, value2, 'entries', value1.entries, value2.entries);
}
@override
bool visitMap(MapConstantValue value1, MapConstantValue value2) {
- ResolutionInterfaceType type1 = value1.type;
- ResolutionInterfaceType type2 = value2.type;
- return strategy.testTypes(value1, value2, 'type', type1, type2) &&
+ return strategy.testTypes(
+ value1, value2, 'type', value1.type, value2.type) &&
strategy.testConstantValueLists(
value1, value2, 'keys', value1.keys, value2.keys) &&
strategy.testConstantValueLists(
@@ -958,9 +954,7 @@ class ConstantValueEquivalence
@override
bool visitType(TypeConstantValue value1, TypeConstantValue value2) {
- ResolutionInterfaceType type1 = value1.type;
- ResolutionInterfaceType type2 = value2.type;
- return strategy.testTypes(value1, value2, 'type', type1, type2);
+ return strategy.testTypes(value1, value2, 'type', value1.type, value2.type);
}
@override
@@ -1018,9 +1012,7 @@ class ConstantValueEquivalence
@override
bool visitInterceptor(
InterceptorConstantValue value1, InterceptorConstantValue value2) {
- ClassElement cls1 = value1.cls;
- ClassElement cls2 = value2.cls;
- return strategy.testElements(value1, value2, 'cls', cls1, cls2);
+ return strategy.testElements(value1, value2, 'cls', value1.cls, value2.cls);
}
}
« no previous file with comments | « pkg/compiler/lib/src/kernel/kernel.dart ('k') | tests/compiler/dart2js/kernel/closed_world2_test.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698