| 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_helper; | 5 library dart2js.serialization_helper; |
| 6 | 6 |
| 7 import 'dart:async'; | 7 import 'dart:async'; |
| 8 import 'dart:io'; | 8 import 'dart:io'; |
| 9 | 9 |
| 10 import 'package:compiler/src/commandline_options.dart'; | 10 import 'package:compiler/src/commandline_options.dart'; |
| (...skipping 70 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 81 | 81 |
| 82 for (int index = first; index <= last; index++) { | 82 for (int index = first; index <= last; index++) { |
| 83 Test test = TESTS[index]; | 83 Test test = TESTS[index]; |
| 84 List<SerializedData> dataList = | 84 List<SerializedData> dataList = |
| 85 await preserializeData(serializedData, test); | 85 await preserializeData(serializedData, test); |
| 86 Map<String, String> sourceFiles = <String, String>{}; | 86 Map<String, String> sourceFiles = <String, String>{}; |
| 87 sourceFiles.addAll(test.sourceFiles); | 87 sourceFiles.addAll(test.sourceFiles); |
| 88 if (test.preserializedSourceFiles != null) { | 88 if (test.preserializedSourceFiles != null) { |
| 89 sourceFiles.addAll(test.preserializedSourceFiles); | 89 sourceFiles.addAll(test.preserializedSourceFiles); |
| 90 } | 90 } |
| 91 if (test.unserializedSourceFiles != null) { |
| 92 sourceFiles.addAll(test.unserializedSourceFiles); |
| 93 } |
| 91 List<Uri> resolutionInputs = <Uri>[]; | 94 List<Uri> resolutionInputs = <Uri>[]; |
| 92 for (SerializedData data in dataList) { | 95 for (SerializedData data in dataList) { |
| 93 data.expandMemorySourceFiles(sourceFiles); | 96 data.expandMemorySourceFiles(sourceFiles); |
| 94 data.expandUris(resolutionInputs); | 97 data.expandUris(resolutionInputs); |
| 95 } | 98 } |
| 96 await testFunction(entryPoint, | 99 await testFunction(entryPoint, |
| 97 sourceFiles: sourceFiles, | 100 sourceFiles: sourceFiles, |
| 98 resolutionInputs: resolutionInputs, | 101 resolutionInputs: resolutionInputs, |
| 99 index: index, | 102 index: index, |
| 100 test: test, | 103 test: test, |
| (...skipping 88 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 189 SerializedData serializedData, Test test) async { | 192 SerializedData serializedData, Test test) async { |
| 190 if (test == null || | 193 if (test == null || |
| 191 test.preserializedSourceFiles == null || | 194 test.preserializedSourceFiles == null || |
| 192 test.preserializedSourceFiles.isEmpty) { | 195 test.preserializedSourceFiles.isEmpty) { |
| 193 return <SerializedData>[serializedData]; | 196 return <SerializedData>[serializedData]; |
| 194 } | 197 } |
| 195 List<Uri> uriList = <Uri>[]; | 198 List<Uri> uriList = <Uri>[]; |
| 196 for (String key in test.preserializedSourceFiles.keys) { | 199 for (String key in test.preserializedSourceFiles.keys) { |
| 197 uriList.add(Uri.parse('memory:$key')); | 200 uriList.add(Uri.parse('memory:$key')); |
| 198 } | 201 } |
| 202 Map<String, String> sourceFiles = serializedData.toMemorySourceFiles(); |
| 203 sourceFiles.addAll(test.preserializedSourceFiles); |
| 204 if (test.unserializedSourceFiles != null) { |
| 205 sourceFiles.addAll(test.unserializedSourceFiles); |
| 206 } |
| 199 Compiler compiler = compilerFor( | 207 Compiler compiler = compilerFor( |
| 200 memorySourceFiles: | 208 memorySourceFiles: sourceFiles, |
| 201 serializedData.toMemorySourceFiles(test.preserializedSourceFiles), | |
| 202 resolutionInputs: serializedData.toUris(), | 209 resolutionInputs: serializedData.toUris(), |
| 203 options: [Flags.analyzeOnly, Flags.analyzeMain]); | 210 options: [Flags.analyzeOnly, Flags.analyzeMain]); |
| 204 compiler.librariesToAnalyzeWhenRun = uriList; | 211 compiler.librariesToAnalyzeWhenRun = uriList; |
| 205 compiler.serialization.supportSerialization = true; | 212 compiler.serialization.supportSerialization = true; |
| 206 await compiler.run(null); | 213 await compiler.run(null); |
| 207 List<LibraryElement> libraries = <LibraryElement>[]; | 214 List<LibraryElement> libraries = <LibraryElement>[]; |
| 208 for (Uri uri in uriList) { | 215 for (Uri uri in uriList) { |
| 209 libraries.add(compiler.libraryLoader.lookupLibrary(uri)); | 216 libraries.add(compiler.libraryLoader.lookupLibrary(uri)); |
| 210 } | 217 } |
| 211 SerializedData additionalSerializedData = | 218 SerializedData additionalSerializedData = |
| 212 new SerializedData(Uri.parse('memory:additional.data'), | 219 new SerializedData(Uri.parse('memory:additional.data'), |
| 213 extractSerializedData(compiler, libraries)); | 220 extractSerializedData(compiler, libraries)); |
| 214 return <SerializedData>[serializedData, additionalSerializedData]; | 221 return <SerializedData>[serializedData, additionalSerializedData]; |
| 215 } | 222 } |
| OLD | NEW |