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_resolved_ast_test; | 5 library dart2js.serialization_resolved_ast_test; |
6 | 6 |
7 import 'dart:async'; | 7 import 'dart:async'; |
8 import 'package:async_helper/async_helper.dart'; | 8 import 'package:async_helper/async_helper.dart'; |
9 import 'package:expect/expect.dart'; | 9 import 'package:expect/expect.dart'; |
10 import 'package:compiler/src/commandline_options.dart'; | 10 import 'package:compiler/src/commandline_options.dart'; |
(...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
61 } | 61 } |
62 | 62 |
63 void checkAllResolvedAsts( | 63 void checkAllResolvedAsts( |
64 Compiler compiler1, | 64 Compiler compiler1, |
65 Compiler compiler2, | 65 Compiler compiler2, |
66 {bool verbose: false}) { | 66 {bool verbose: false}) { |
67 checkLoadedLibraryMembers( | 67 checkLoadedLibraryMembers( |
68 compiler1, | 68 compiler1, |
69 compiler2, | 69 compiler2, |
70 (Element member1) { | 70 (Element member1) { |
71 return compiler1.resolution.hasResolvedAst(member1); | 71 return member1 is ExecutableElement && |
| 72 compiler1.resolution.hasResolvedAst(member1); |
72 }, | 73 }, |
73 checkResolvedAsts, | 74 checkResolvedAsts, |
74 verbose: verbose); | 75 verbose: verbose); |
75 } | 76 } |
76 | 77 |
77 | 78 |
78 /// Check equivalence of [impact1] and [impact2]. | 79 /// Check equivalence of [impact1] and [impact2]. |
79 void checkResolvedAsts(Compiler compiler1, Element member1, | 80 void checkResolvedAsts(Compiler compiler1, Element member1, |
80 Compiler compiler2, Element member2, | 81 Compiler compiler2, Element member2, |
81 {bool verbose: false}) { | 82 {bool verbose: false}) { |
82 ResolvedAst resolvedAst1 = compiler1.resolution.getResolvedAst(member1); | 83 ResolvedAst resolvedAst1 = compiler1.resolution.getResolvedAst(member1); |
83 ResolvedAst resolvedAst2 = | 84 ResolvedAst resolvedAst2 = |
84 compiler2.serialization.deserializer.getResolvedAst(member2); | 85 compiler2.serialization.deserializer.getResolvedAst(member2); |
85 | 86 |
86 if (resolvedAst1 == null || resolvedAst2 == null) return; | 87 if (resolvedAst1 == null || resolvedAst2 == null) return; |
87 | 88 |
88 if (verbose) { | 89 if (verbose) { |
89 print('Checking resolved asts for $member1 vs $member2'); | 90 print('Checking resolved asts for $member1 vs $member2'); |
90 } | 91 } |
91 | 92 |
92 testResolvedAstEquivalence( | 93 testResolvedAstEquivalence( |
93 resolvedAst1, resolvedAst2, const CheckStrategy()); | 94 resolvedAst1, resolvedAst2, const CheckStrategy()); |
94 } | 95 } |
OLD | NEW |