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

Side by Side Diff: tests/compiler/dart2js/serialization/resolved_ast_test.dart

Issue 2088233003: Serialize erroneous element and more (Closed) Base URL: https://github.com/dart-lang/sdk.git@master
Patch Set: Updated cf. comments. Created 4 years, 6 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
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_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:compiler/src/commandline_options.dart'; 9 import 'package:compiler/src/commandline_options.dart';
10 import 'package:compiler/src/compiler.dart'; 10 import 'package:compiler/src/compiler.dart';
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after
48 48
49 Compiler compilerDeserialized = compilerFor( 49 Compiler compilerDeserialized = compilerFor(
50 memorySourceFiles: serializedData.toMemorySourceFiles(sourceFiles), 50 memorySourceFiles: serializedData.toMemorySourceFiles(sourceFiles),
51 resolutionInputs: serializedData.toUris(), 51 resolutionInputs: serializedData.toUris(),
52 options: [Flags.analyzeAll]); 52 options: [Flags.analyzeAll]);
53 compilerDeserialized.resolution.retainCachesForTesting = true; 53 compilerDeserialized.resolution.retainCachesForTesting = true;
54 await compilerDeserialized.run(entryPoint); 54 await compilerDeserialized.run(entryPoint);
55 55
56 checkAllResolvedAsts(compilerNormal, compilerDeserialized, verbose: true); 56 checkAllResolvedAsts(compilerNormal, compilerDeserialized, verbose: true);
57 } 57 }
58
59 void checkAllResolvedAsts(
60 Compiler compiler1,
61 Compiler compiler2,
62 {bool verbose: false}) {
63 checkLoadedLibraryMembers(
64 compiler1,
65 compiler2,
66 (Element member1) {
67 return member1 is ExecutableElement &&
68 compiler1.resolution.hasResolvedAst(member1);
69 },
70 checkResolvedAsts,
71 verbose: verbose);
72 }
73
74
75 /// Check equivalence of [impact1] and [impact2].
76 void checkResolvedAsts(Compiler compiler1, Element member1,
77 Compiler compiler2, Element member2,
78 {bool verbose: false}) {
79 if (!compiler2.serialization.isDeserialized(member2)) {
80 return;
81 }
82 ResolvedAst resolvedAst1 = compiler1.resolution.getResolvedAst(member1);
83 ResolvedAst resolvedAst2 = compiler2.serialization.getResolvedAst(member2);
84
85 if (resolvedAst1 == null || resolvedAst2 == null) return;
86
87 if (verbose) {
88 print('Checking resolved asts for $member1 vs $member2');
89 }
90
91 testResolvedAstEquivalence(
92 resolvedAst1, resolvedAst2, const CheckStrategy());
93 }
OLDNEW
« no previous file with comments | « tests/compiler/dart2js/serialization/reserialization_test.dart ('k') | tests/compiler/dart2js/serialization/test_helper.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698