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

Side by Side Diff: tests/compiler/dart2js/serialization_analysis_test.dart

Issue 1802883002: Use JS backend in serialization_analysis_test (Closed) Base URL: https://github.com/dart-lang/sdk.git@master
Patch Set: Serialize ClassElement.isUnnamedMixinApplication and test added properties. Created 4 years, 9 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) 2015, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2015, 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_analysis_test; 5 library dart2js.serialization_analysis_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 163 matching lines...) Expand 10 before | Expand all | Expand 10 after
174 this.expectedInfoCount: 0}); 174 this.expectedInfoCount: 0});
175 } 175 }
176 176
177 Future analyze(String serializedData, Uri entryPoint, Test test) async { 177 Future analyze(String serializedData, Uri entryPoint, Test test) async {
178 Deserializer deserializer = new Deserializer.fromText( 178 Deserializer deserializer = new Deserializer.fromText(
179 serializedData, const JsonSerializationDecoder()); 179 serializedData, const JsonSerializationDecoder());
180 DiagnosticCollector diagnosticCollector = new DiagnosticCollector(); 180 DiagnosticCollector diagnosticCollector = new DiagnosticCollector();
181 await runCompiler( 181 await runCompiler(
182 entryPoint: entryPoint, 182 entryPoint: entryPoint,
183 memorySourceFiles: test != null ? test.sourceFiles : const {}, 183 memorySourceFiles: test != null ? test.sourceFiles : const {},
184 options: [Flags.analyzeOnly, '--output-type=dart'], 184 options: [Flags.analyzeOnly],
185 diagnosticHandler: diagnosticCollector, 185 diagnosticHandler: diagnosticCollector,
186 beforeRun: (Compiler compiler) { 186 beforeRun: (Compiler compiler) {
187 compiler.serialization.deserializer = 187 compiler.serialization.deserializer =
188 new _DeserializerSystem(deserializer); 188 new _DeserializerSystem(deserializer);
189 }); 189 });
190 if (test != null) { 190 if (test != null) {
191 Expect.equals(test.expectedErrorCount, diagnosticCollector.errors.length, 191 Expect.equals(test.expectedErrorCount, diagnosticCollector.errors.length,
192 "Unexpected error count."); 192 "Unexpected error count.");
193 Expect.equals( 193 Expect.equals(
194 test.expectedWarningCount, 194 test.expectedWarningCount,
195 diagnosticCollector.warnings.length, 195 diagnosticCollector.warnings.length,
196 "Unexpected warning count."); 196 "Unexpected warning count.");
197 Expect.equals(test.expectedHintCount, diagnosticCollector.hints.length, 197 Expect.equals(test.expectedHintCount, diagnosticCollector.hints.length,
198 "Unexpected hint count."); 198 "Unexpected hint count.");
199 Expect.equals(test.expectedInfoCount, diagnosticCollector.infos.length, 199 Expect.equals(test.expectedInfoCount, diagnosticCollector.infos.length,
200 "Unexpected info count."); 200 "Unexpected info count.");
201 } 201 }
202 } 202 }
203 203
204 Future<String> serializeDartCore() async { 204 Future<String> serializeDartCore() async {
205 Compiler compiler = compilerFor( 205 Compiler compiler = compilerFor(
206 options: ['--analyze-all', '--output-type=dart']); 206 options: ['--analyze-all']);
207 await compiler.run(Uri.parse('dart:core')); 207 await compiler.run(Uri.parse('dart:core'));
208 return serialize(compiler.libraryLoader.libraries); 208 return serialize(compiler.libraryLoader.libraries);
209 } 209 }
210 210
211 String serialize(Iterable<LibraryElement> libraries) { 211 String serialize(Iterable<LibraryElement> libraries) {
212 Serializer serializer = new Serializer(const JsonSerializationEncoder()); 212 Serializer serializer = new Serializer(const JsonSerializationEncoder());
213 for (LibraryElement library in libraries) { 213 for (LibraryElement library in libraries) {
214 serializer.serialize(library); 214 serializer.serialize(library);
215 } 215 }
216 return serializer.toText(); 216 return serializer.toText();
(...skipping 16 matching lines...) Expand all
233 @override 233 @override
234 WorldImpact computeWorldImpact(Element element) { 234 WorldImpact computeWorldImpact(Element element) {
235 return const WorldImpact(); 235 return const WorldImpact();
236 } 236 }
237 237
238 @override 238 @override
239 bool isDeserialized(Element element) { 239 bool isDeserialized(Element element) {
240 return deserializedLibraries.contains(element.library); 240 return deserializedLibraries.contains(element.library);
241 } 241 }
242 } 242 }
OLDNEW
« no previous file with comments | « pkg/compiler/lib/src/serialization/modelz.dart ('k') | tests/compiler/dart2js/serialization_test.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698