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

Side by Side Diff: pkg/compiler/lib/src/serialization/equivalence.dart

Issue 2662253002: Handle private dynamic access in impact_test. (Closed)
Patch Set: Created 3 years, 10 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 unified diff | Download patch
« no previous file with comments | « no previous file | tests/compiler/dart2js/kernel/impact_test.dart » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2016, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2016, the Dart project authors. Please see the AUTHORS file
2 // for details. All rights reserved. Use of this source code is governed by a 2 // for details. All rights reserved. Use of this source code is governed by a
3 // BSD-style license that can be found in the LICENSE file. 3 // BSD-style license that can be found in the LICENSE file.
4 4
5 /// Functions for asserting equivalence across serialization. 5 /// Functions for asserting equivalence across serialization.
6 6
7 library dart2js.serialization.equivalence; 7 library dart2js.serialization.equivalence;
8 8
9 import '../closure.dart'; 9 import '../closure.dart';
10 import '../common/resolution.dart'; 10 import '../common/resolution.dart';
(...skipping 132 matching lines...) Expand 10 before | Expand all | Expand 10 after
143 return areListsEquivalent(a, b, areConstantsEquivalent); 143 return areListsEquivalent(a, b, areConstantsEquivalent);
144 } 144 }
145 145
146 /// Returns `true` if the lists of constant values, [a] and [b], are equivalent. 146 /// Returns `true` if the lists of constant values, [a] and [b], are equivalent.
147 bool areConstantValueListsEquivalent( 147 bool areConstantValueListsEquivalent(
148 List<ConstantValue> a, List<ConstantValue> b) { 148 List<ConstantValue> a, List<ConstantValue> b) {
149 return areListsEquivalent(a, b, areConstantValuesEquivalent); 149 return areListsEquivalent(a, b, areConstantValuesEquivalent);
150 } 150 }
151 151
152 /// Returns `true` if the selectors [a] and [b] are equivalent. 152 /// Returns `true` if the selectors [a] and [b] are equivalent.
153 bool areSelectorsEquivalent(Selector a, Selector b) { 153 bool areSelectorsEquivalent(Selector a, Selector b,
154 {TestStrategy strategy: const TestStrategy()}) {
154 if (identical(a, b)) return true; 155 if (identical(a, b)) return true;
155 if (a == null || b == null) return false; 156 if (a == null || b == null) return false;
156 return a.kind == b.kind && 157 return a.kind == b.kind &&
157 a.callStructure == b.callStructure && 158 a.callStructure == b.callStructure &&
158 areNamesEquivalent(a.memberName, b.memberName); 159 areNamesEquivalent(a.memberName, b.memberName, strategy: strategy);
159 } 160 }
160 161
161 /// Returns `true` if the names [a] and [b] are equivalent. 162 /// Returns `true` if the names [a] and [b] are equivalent.
162 bool areNamesEquivalent(Name a, Name b) { 163 bool areNamesEquivalent(Name a, Name b,
163 LibraryElement library1 = a.library; 164 {TestStrategy strategy: const TestStrategy()}) {
164 LibraryElement library2 = b.library;
165 return a.text == b.text && 165 return a.text == b.text &&
166 a.isSetter == b.isSetter && 166 a.isSetter == b.isSetter &&
167 areElementsEquivalent(library1, library2); 167 strategy.testElements(a, b, 'library', a.library, b.library);
168 } 168 }
169 169
170 /// Returns `true` if the dynamic uses [a] and [b] are equivalent. 170 /// Returns `true` if the dynamic uses [a] and [b] are equivalent.
171 bool areDynamicUsesEquivalent(DynamicUse a, DynamicUse b) { 171 bool areDynamicUsesEquivalent(DynamicUse a, DynamicUse b,
172 return areSelectorsEquivalent(a.selector, b.selector); 172 {TestStrategy strategy: const TestStrategy()}) {
173 return areSelectorsEquivalent(a.selector, b.selector, strategy: strategy);
173 } 174 }
174 175
175 /// Returns `true` if the static uses [a] and [b] are equivalent. 176 /// Returns `true` if the static uses [a] and [b] are equivalent.
176 bool areStaticUsesEquivalent(StaticUse a, StaticUse b, 177 bool areStaticUsesEquivalent(StaticUse a, StaticUse b,
177 {TestStrategy strategy: const TestStrategy()}) { 178 {TestStrategy strategy: const TestStrategy()}) {
178 return a.kind == b.kind && 179 return a.kind == b.kind &&
179 strategy.testElements(a, b, 'element', a.element, b.element); 180 strategy.testElements(a, b, 'element', a.element, b.element);
180 } 181 }
181 182
182 /// Returns `true` if the type uses [a] and [b] are equivalent. 183 /// Returns `true` if the type uses [a] and [b] are equivalent.
(...skipping 836 matching lines...) Expand 10 before | Expand all | Expand 10 after
1019 {TestStrategy strategy = const TestStrategy()}) { 1020 {TestStrategy strategy = const TestStrategy()}) {
1020 return strategy.testSets(impact1, impact2, 'constSymbolNames', 1021 return strategy.testSets(impact1, impact2, 'constSymbolNames',
1021 impact1.constSymbolNames, impact2.constSymbolNames) && 1022 impact1.constSymbolNames, impact2.constSymbolNames) &&
1022 strategy.testSets( 1023 strategy.testSets(
1023 impact1, 1024 impact1,
1024 impact2, 1025 impact2,
1025 'constantLiterals', 1026 'constantLiterals',
1026 impact1.constantLiterals, 1027 impact1.constantLiterals,
1027 impact2.constantLiterals, 1028 impact2.constantLiterals,
1028 areConstantsEquivalent) && 1029 areConstantsEquivalent) &&
1029 strategy.testSets(impact1, impact2, 'dynamicUses', impact1.dynamicUses, 1030 strategy.testSets(
1030 impact2.dynamicUses, areDynamicUsesEquivalent) && 1031 impact1,
1032 impact2,
1033 'dynamicUses',
1034 impact1.dynamicUses,
1035 impact2.dynamicUses,
1036 (a, b) =>
1037 areDynamicUsesEquivalent(a, b, strategy: strategy.testOnly)) &&
1031 strategy.testSets( 1038 strategy.testSets(
1032 impact1, impact2, 'features', impact1.features, impact2.features) && 1039 impact1, impact2, 'features', impact1.features, impact2.features) &&
1033 strategy.testSets( 1040 strategy.testSets(
1034 impact1, 1041 impact1,
1035 impact2, 1042 impact2,
1036 'listLiterals', 1043 'listLiterals',
1037 impact1.listLiterals, 1044 impact1.listLiterals,
1038 impact2.listLiterals, 1045 impact2.listLiterals,
1039 (a, b) => areListLiteralUsesEquivalent(a, b, 1046 (a, b) => areListLiteralUsesEquivalent(a, b,
1040 strategy: strategy.testOnly)) && 1047 strategy: strategy.testOnly)) &&
(...skipping 1062 matching lines...) Expand 10 before | Expand all | Expand 10 after
2103 } 2110 }
2104 2111
2105 bool areMetadataAnnotationsEquivalent( 2112 bool areMetadataAnnotationsEquivalent(
2106 MetadataAnnotation metadata1, MetadataAnnotation metadata2) { 2113 MetadataAnnotation metadata1, MetadataAnnotation metadata2) {
2107 if (metadata1 == metadata2) return true; 2114 if (metadata1 == metadata2) return true;
2108 if (metadata1 == null || metadata2 == null) return false; 2115 if (metadata1 == null || metadata2 == null) return false;
2109 return areElementsEquivalent( 2116 return areElementsEquivalent(
2110 metadata1.annotatedElement, metadata2.annotatedElement) && 2117 metadata1.annotatedElement, metadata2.annotatedElement) &&
2111 areConstantsEquivalent(metadata1.constant, metadata2.constant); 2118 areConstantsEquivalent(metadata1.constant, metadata2.constant);
2112 } 2119 }
OLDNEW
« no previous file with comments | « no previous file | tests/compiler/dart2js/kernel/impact_test.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698