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

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

Issue 1901683002: Support deserialization of ResolutionImpact for members of unnamed mixin applications (Closed) Base URL: https://github.com/dart-lang/sdk.git@master
Patch Set: 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_helper.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 276 matching lines...) Expand 10 before | Expand all | Expand 10 after
287 bool hasProperty(Element member1), 287 bool hasProperty(Element member1),
288 void checkMemberProperties(Compiler compiler1, Element member1, 288 void checkMemberProperties(Compiler compiler1, Element member1,
289 Compiler compiler2, Element member2, 289 Compiler compiler2, Element member2,
290 {bool verbose}), 290 {bool verbose}),
291 {bool verbose: false}) { 291 {bool verbose: false}) {
292 292
293 void checkMembers(Element member1, Element member2) { 293 void checkMembers(Element member1, Element member2) {
294 if (member1.isClass && member2.isClass) { 294 if (member1.isClass && member2.isClass) {
295 ClassElement class1 = member1; 295 ClassElement class1 = member1;
296 ClassElement class2 = member2; 296 ClassElement class2 = member2;
297 if (!class1.isResolved) return;
298
297 class1.forEachLocalMember((m1) { 299 class1.forEachLocalMember((m1) {
298 checkMembers(m1, class2.lookupLocalMember(m1.name)); 300 checkMembers(m1, class2.localLookup(m1.name));
299 }); 301 });
302 ClassElement superclass1 = class1.superclass;
303 ClassElement superclass2 = class2.superclass;
304 while (superclass1 != null && superclass1.isUnnamedMixinApplication) {
305 for (ConstructorElement c1 in superclass1.constructors) {
306 checkMembers(c1, superclass2.lookupConstructor(c1.name));
307 }
308 superclass1 = superclass1.superclass;
309 superclass2 = superclass2.superclass;
310 }
300 return; 311 return;
301 } 312 }
302 313
303 if (!hasProperty(member1)) { 314 if (!hasProperty(member1)) {
304 return; 315 return;
305 } 316 }
306 317
307 if (member2 == null) { 318 if (member2 == null) {
308 return; 319 throw 'Missing member for ${member1}';
309 } 320 }
310 321
311 if (areElementsEquivalent(member1, member2)) { 322 if (areElementsEquivalent(member1, member2)) {
312 checkMemberProperties( 323 checkMemberProperties(
313 compiler1, member1, 324 compiler1, member1,
314 compiler2, member2, 325 compiler2, member2,
315 verbose: verbose); 326 verbose: verbose);
316 } 327 }
317 } 328 }
318 329
(...skipping 22 matching lines...) Expand all
341 }, 352 },
342 checkImpacts, 353 checkImpacts,
343 verbose: verbose); 354 verbose: verbose);
344 } 355 }
345 356
346 /// Check equivalence of resolution impact for [member1] and [member2]. 357 /// Check equivalence of resolution impact for [member1] and [member2].
347 void checkImpacts(Compiler compiler1, Element member1, 358 void checkImpacts(Compiler compiler1, Element member1,
348 Compiler compiler2, Element member2, 359 Compiler compiler2, Element member2,
349 {bool verbose: false}) { 360 {bool verbose: false}) {
350 ResolutionImpact impact1 = compiler1.resolution.getResolutionImpact(member1); 361 ResolutionImpact impact1 = compiler1.resolution.getResolutionImpact(member1);
351 ResolutionImpact impact2 = 362 ResolutionImpact impact2 = compiler2.resolution.getResolutionImpact(member2);
352 compiler2.serialization.deserializer.getResolutionImpact(member2);
353 363
354 if (impact1 == null || impact2 == null) return; 364 if (impact1 == null && impact2 == null) return;
355 365
356 if (verbose) { 366 if (verbose) {
357 print('Checking impacts for $member1 vs $member2'); 367 print('Checking impacts for $member1 vs $member2');
358 } 368 }
359 369
370 if (impact1 == null) {
371 throw 'Missing impact for $member1. $member2 has $impact2';
372 }
373 if (impact2 == null) {
374 throw 'Missing impact for $member2. $member1 has $impact1';
375 }
376
360 testResolutionImpactEquivalence(impact1, impact2, const CheckStrategy()); 377 testResolutionImpactEquivalence(impact1, impact2, const CheckStrategy());
361 } 378 }
OLDNEW
« no previous file with comments | « tests/compiler/dart2js/serialization_helper.dart ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698