OLD | NEW |
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:collection'; | 7 import 'dart:collection'; |
8 import 'package:compiler/src/common/resolution.dart'; | 8 import 'package:compiler/src/common/resolution.dart'; |
9 import 'package:compiler/src/constants/expressions.dart'; | 9 import 'package:compiler/src/constants/expressions.dart'; |
10 import 'package:compiler/src/dart_types.dart'; | 10 import 'package:compiler/src/dart_types.dart'; |
(...skipping 535 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
546 (mismatch.isNotEmpty && failOnMismatch) || | 546 (mismatch.isNotEmpty && failOnMismatch) || |
547 remaining.isNotEmpty) { | 547 remaining.isNotEmpty) { |
548 Expect.fail(message); | 548 Expect.fail(message); |
549 } else { | 549 } else { |
550 print(message); | 550 print(message); |
551 } | 551 } |
552 } else if (verbose) { | 552 } else if (verbose) { |
553 print(message); | 553 print(message); |
554 } | 554 } |
555 } | 555 } |
| 556 |
| 557 void checkAllResolvedAsts( |
| 558 Compiler compiler1, |
| 559 Compiler compiler2, |
| 560 {bool verbose: false}) { |
| 561 checkLoadedLibraryMembers( |
| 562 compiler1, |
| 563 compiler2, |
| 564 (Element member1) { |
| 565 return member1 is ExecutableElement && |
| 566 compiler1.resolution.hasResolvedAst(member1); |
| 567 }, |
| 568 checkResolvedAsts, |
| 569 verbose: verbose); |
| 570 } |
| 571 |
| 572 |
| 573 /// Check equivalence of [impact1] and [impact2]. |
| 574 void checkResolvedAsts(Compiler compiler1, Element member1, |
| 575 Compiler compiler2, Element member2, |
| 576 {bool verbose: false}) { |
| 577 if (!compiler2.serialization.isDeserialized(member2)) { |
| 578 return; |
| 579 } |
| 580 ResolvedAst resolvedAst1 = compiler1.resolution.getResolvedAst(member1); |
| 581 ResolvedAst resolvedAst2 = compiler2.serialization.getResolvedAst(member2); |
| 582 |
| 583 if (resolvedAst1 == null || resolvedAst2 == null) return; |
| 584 |
| 585 if (verbose) { |
| 586 print('Checking resolved asts for $member1 vs $member2'); |
| 587 } |
| 588 |
| 589 testResolvedAstEquivalence( |
| 590 resolvedAst1, resolvedAst2, const CheckStrategy()); |
| 591 } |
OLD | NEW |