| Index: tests/compiler/dart2js/serialization/helper.dart
|
| diff --git a/tests/compiler/dart2js/serialization/helper.dart b/tests/compiler/dart2js/serialization/helper.dart
|
| index 3f2b42973917d8c67ce58b1a623808c7046befc8..e70b2ac106ef7ceafd85b25a5054577455b4e2d5 100644
|
| --- a/tests/compiler/dart2js/serialization/helper.dart
|
| +++ b/tests/compiler/dart2js/serialization/helper.dart
|
| @@ -127,25 +127,39 @@ Future<SerializedData> serializeDartCore(
|
| print('Loading data from $file');
|
| serializedData = new SerializedData(uri, file.readAsStringSync());
|
| }
|
| + } else {
|
| + SerializationResult result = await serialize(Uris.dart_core, uri);
|
| + serializedData = result.serializedData;
|
| }
|
| - if (serializedData == null) {
|
| - Compiler compiler = compilerFor(
|
| - options: [Flags.analyzeAll]);
|
| - compiler.serialization.supportSerialization = true;
|
| - await compiler.run(Uris.dart_core);
|
| - BufferedEventSink sink = new BufferedEventSink();
|
| - compiler.serialization.serializeToSink(
|
| - sink, compiler.libraryLoader.libraries);
|
| - serializedData = new SerializedData(uri, sink.text);
|
| - if (arguments.saveSerializedData) {
|
| - File file = new File(arguments.serializedDataFileName);
|
| - print('Saving data to $file');
|
| - file.writeAsStringSync(serializedData.data);
|
| - }
|
| + if (arguments.saveSerializedData) {
|
| + File file = new File(arguments.serializedDataFileName);
|
| + print('Saving data to $file');
|
| + file.writeAsStringSync(serializedData.data);
|
| }
|
| return serializedData;
|
| }
|
|
|
| +class SerializationResult {
|
| + final Compiler compiler;
|
| + final SerializedData serializedData;
|
| +
|
| + SerializationResult(this.compiler, this.serializedData);
|
| +}
|
| +
|
| +Future<SerializationResult> serialize(Uri entryPoint, [Uri dataUri]) async {
|
| + if (dataUri == null) {
|
| + dataUri = Uri.parse('memory:${DEFAULT_DATA_FILE_NAME}');
|
| + }
|
| + Compiler compiler = compilerFor(options: [Flags.analyzeAll]);
|
| + compiler.serialization.supportSerialization = true;
|
| + await compiler.run(entryPoint);
|
| + BufferedEventSink sink = new BufferedEventSink();
|
| + compiler.serialization.serializeToSink(
|
| + sink, compiler.libraryLoader.libraries);
|
| + SerializedData serializedData = new SerializedData(dataUri, sink.text);
|
| + return new SerializationResult(compiler, serializedData);
|
| +}
|
| +
|
| class SerializedData {
|
| final Uri uri;
|
| final String data;
|
|
|