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

Side by Side Diff: tests/compiler/dart2js/serialization_test_helper.dart

Issue 1881013002: Expand ResolvedAst to handle synthetic constructors. (Closed) Base URL: https://github.com/dart-lang/sdk.git@master
Patch Set: Updated cf. comments + fix test, cps and compilation units for injected members. Created 4 years, 8 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 | « tests/compiler/dart2js/serialization_test.dart ('k') | no next file » | 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 library dart2js.serialization_test_helper; 5 library dart2js.serialization_test_helper;
6 6
7 import 'dart:io'; 7 import 'dart:io';
8 import 'memory_compiler.dart'; 8 import 'memory_compiler.dart';
9 import 'package:async_helper/async_helper.dart'; 9 import 'package:async_helper/async_helper.dart';
10 import 'package:compiler/src/common/resolution.dart'; 10 import 'package:compiler/src/common/resolution.dart';
(...skipping 86 matching lines...) Expand 10 before | Expand all | Expand 10 after
97 List<ConstantExpression> list2) { 97 List<ConstantExpression> list2) {
98 return checkConstantLists(object1, object2, property, list1, list2); 98 return checkConstantLists(object1, object2, property, list1, list2);
99 } 99 }
100 } 100 }
101 101
102 /// Check that the values [property] of [object1] and [object2], [value1] and 102 /// Check that the values [property] of [object1] and [object2], [value1] and
103 /// [value2] respectively, are equal and throw otherwise. 103 /// [value2] respectively, are equal and throw otherwise.
104 bool check(var object1, var object2, String property, var value1, var value2, 104 bool check(var object1, var object2, String property, var value1, var value2,
105 [bool equivalence(a, b) = equality]) { 105 [bool equivalence(a, b) = equality]) {
106 if (!equivalence(value1, value2)) { 106 if (!equivalence(value1, value2)) {
107 throw "property='$property' " 107 throw "property='$property'\n "
108 "object1=$object1 (${object1.runtimeType}), value='${value1}' <> " 108 "object1=$object1 (${object1.runtimeType})\n value='${value1}' <>\n "
109 "object2=$object2 (${object2.runtimeType}), value='${value2}'"; 109 "object2=$object2 (${object2.runtimeType})\n value='${value2}'";
110 } 110 }
111 return true; 111 return true;
112 } 112 }
113 113
114 /// Check equivalence of the two lists, [list1] and [list2], using 114 /// Check equivalence of the two lists, [list1] and [list2], using
115 /// [checkEquivalence] to check the pair-wise equivalence. 115 /// [checkEquivalence] to check the pair-wise equivalence.
116 /// 116 ///
117 /// Uses [object1], [object2] and [property] to provide context for failures. 117 /// Uses [object1], [object2] and [property] to provide context for failures.
118 bool checkListEquivalence( 118 bool checkListEquivalence(
119 Object object1, Object object2, String property, 119 Object object1, Object object2, String property,
(...skipping 85 matching lines...) Expand 10 before | Expand all | Expand 10 after
205 } 205 }
206 206
207 /// Checks the equivalence of the identity (but not properties) of [element1] 207 /// Checks the equivalence of the identity (but not properties) of [element1]
208 /// and [element2]. 208 /// and [element2].
209 /// 209 ///
210 /// Uses [object1], [object2] and [property] to provide context for failures. 210 /// Uses [object1], [object2] and [property] to provide context for failures.
211 bool checkElementIdentities( 211 bool checkElementIdentities(
212 Object object1, Object object2, String property, 212 Object object1, Object object2, String property,
213 Element element1, Element element2) { 213 Element element1, Element element2) {
214 if (identical(element1, element2)) return true; 214 if (identical(element1, element2)) return true;
215 if (element1 == null || element2 == null) { 215 return check(object1, object2,
216 return check(object1, object2, property, element1, element2); 216 property, element1, element2, areElementsEquivalent);
217 } else {
218 return const ElementIdentityEquivalence(const CheckStrategy())
219 .visit(element1, element2);
220 }
221 } 217 }
222 218
223 /// Checks the pair-wise equivalence of the identity (but not properties) of the 219 /// Checks the pair-wise equivalence of the identity (but not properties) of the
224 /// elements in [list] and [list2]. 220 /// elements in [list] and [list2].
225 /// 221 ///
226 /// Uses [object1], [object2] and [property] to provide context for failures. 222 /// Uses [object1], [object2] and [property] to provide context for failures.
227 bool checkElementListIdentities( 223 bool checkElementListIdentities(
228 Object object1, Object object2, String property, 224 Object object1, Object object2, String property,
229 Iterable<Element> list1, Iterable<Element> list2) { 225 Iterable<Element> list1, Iterable<Element> list2) {
230 return checkListEquivalence( 226 return checkListEquivalence(
(...skipping 125 matching lines...) Expand 10 before | Expand all | Expand 10 after
356 compiler2.serialization.deserializer.getResolutionImpact(member2); 352 compiler2.serialization.deserializer.getResolutionImpact(member2);
357 353
358 if (impact1 == null || impact2 == null) return; 354 if (impact1 == null || impact2 == null) return;
359 355
360 if (verbose) { 356 if (verbose) {
361 print('Checking impacts for $member1 vs $member2'); 357 print('Checking impacts for $member1 vs $member2');
362 } 358 }
363 359
364 testResolutionImpactEquivalence(impact1, impact2, const CheckStrategy()); 360 testResolutionImpactEquivalence(impact1, impact2, const CheckStrategy());
365 } 361 }
OLDNEW
« no previous file with comments | « tests/compiler/dart2js/serialization_test.dart ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698