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'; | |
10 import 'package:compiler/src/commandline_options.dart'; | 9 import 'package:compiler/src/commandline_options.dart'; |
11 import 'package:compiler/src/common/backend_api.dart'; | |
12 import 'package:compiler/src/common/names.dart'; | |
13 import 'package:compiler/src/compiler.dart'; | 10 import 'package:compiler/src/compiler.dart'; |
14 import 'package:compiler/src/elements/elements.dart'; | 11 import 'package:compiler/src/elements/elements.dart'; |
15 import 'package:compiler/src/filenames.dart'; | 12 import 'package:compiler/src/filenames.dart'; |
16 import 'package:compiler/src/serialization/equivalence.dart'; | 13 import 'package:compiler/src/serialization/equivalence.dart'; |
17 import '../memory_compiler.dart'; | 14 import '../memory_compiler.dart'; |
18 import 'helper.dart'; | 15 import 'helper.dart'; |
19 import 'test_data.dart'; | 16 import 'test_data.dart'; |
20 import 'test_helper.dart'; | 17 import 'test_helper.dart'; |
21 | 18 |
22 | 19 |
(...skipping 22 matching lines...) Expand all Loading... |
45 Compiler compilerNormal = compilerFor( | 42 Compiler compilerNormal = compilerFor( |
46 memorySourceFiles: sourceFiles, | 43 memorySourceFiles: sourceFiles, |
47 options: [Flags.analyzeAll]); | 44 options: [Flags.analyzeAll]); |
48 compilerNormal.resolution.retainCachesForTesting = true; | 45 compilerNormal.resolution.retainCachesForTesting = true; |
49 await compilerNormal.run(entryPoint); | 46 await compilerNormal.run(entryPoint); |
50 | 47 |
51 Compiler compilerDeserialized = compilerFor( | 48 Compiler compilerDeserialized = compilerFor( |
52 memorySourceFiles: sourceFiles, | 49 memorySourceFiles: sourceFiles, |
53 options: [Flags.analyzeAll]); | 50 options: [Flags.analyzeAll]); |
54 compilerDeserialized.resolution.retainCachesForTesting = true; | 51 compilerDeserialized.resolution.retainCachesForTesting = true; |
55 deserialize(compilerDeserialized, serializedData); | 52 compilerDeserialized.serialization.deserializeFromText(serializedData); |
56 await compilerDeserialized.run(entryPoint); | 53 await compilerDeserialized.run(entryPoint); |
57 | 54 |
58 checkAllResolvedAsts(compilerNormal, compilerDeserialized, verbose: true); | 55 checkAllResolvedAsts(compilerNormal, compilerDeserialized, verbose: true); |
59 } | 56 } |
60 | 57 |
61 void checkAllResolvedAsts( | 58 void checkAllResolvedAsts( |
62 Compiler compiler1, | 59 Compiler compiler1, |
63 Compiler compiler2, | 60 Compiler compiler2, |
64 {bool verbose: false}) { | 61 {bool verbose: false}) { |
65 checkLoadedLibraryMembers( | 62 checkLoadedLibraryMembers( |
(...skipping 18 matching lines...) Expand all Loading... |
84 | 81 |
85 if (resolvedAst1 == null || resolvedAst2 == null) return; | 82 if (resolvedAst1 == null || resolvedAst2 == null) return; |
86 | 83 |
87 if (verbose) { | 84 if (verbose) { |
88 print('Checking resolved asts for $member1 vs $member2'); | 85 print('Checking resolved asts for $member1 vs $member2'); |
89 } | 86 } |
90 | 87 |
91 testResolvedAstEquivalence( | 88 testResolvedAstEquivalence( |
92 resolvedAst1, resolvedAst2, const CheckStrategy()); | 89 resolvedAst1, resolvedAst2, const CheckStrategy()); |
93 } | 90 } |
OLD | NEW |