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