OLD | NEW |
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/elements/elements.dart'; | 11 import 'package:compiler/src/elements/elements.dart'; |
11 import 'package:compiler/src/compiler.dart'; | 12 import 'package:compiler/src/compiler.dart'; |
12 import 'package:compiler/src/enqueue.dart'; | 13 import 'package:compiler/src/enqueue.dart'; |
13 import 'package:compiler/src/filenames.dart'; | 14 import 'package:compiler/src/filenames.dart'; |
14 import 'package:compiler/src/serialization/serialization.dart'; | 15 import 'package:compiler/src/serialization/serialization.dart'; |
15 import 'package:compiler/src/serialization/json_serializer.dart'; | 16 import 'package:compiler/src/serialization/json_serializer.dart'; |
16 import 'package:compiler/src/serialization/task.dart'; | 17 import 'package:compiler/src/serialization/task.dart'; |
17 import 'memory_compiler.dart'; | 18 import 'memory_compiler.dart'; |
18 | 19 |
19 const List<Test> TESTS = const <Test>[ | 20 const List<Test> TESTS = const <Test>[ |
(...skipping 153 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
173 this.expectedInfoCount: 0}); | 174 this.expectedInfoCount: 0}); |
174 } | 175 } |
175 | 176 |
176 Future analyze(String serializedData, Uri entryPoint, Test test) async { | 177 Future analyze(String serializedData, Uri entryPoint, Test test) async { |
177 Deserializer deserializer = new Deserializer.fromText( | 178 Deserializer deserializer = new Deserializer.fromText( |
178 serializedData, const JsonSerializationDecoder()); | 179 serializedData, const JsonSerializationDecoder()); |
179 DiagnosticCollector diagnosticCollector = new DiagnosticCollector(); | 180 DiagnosticCollector diagnosticCollector = new DiagnosticCollector(); |
180 await runCompiler( | 181 await runCompiler( |
181 entryPoint: entryPoint, | 182 entryPoint: entryPoint, |
182 memorySourceFiles: test != null ? test.sourceFiles : const {}, | 183 memorySourceFiles: test != null ? test.sourceFiles : const {}, |
183 options: ['--analyze-only', '--output-type=dart'], | 184 options: [Flags.analyzeOnly, '--output-type=dart'], |
184 diagnosticHandler: diagnosticCollector, | 185 diagnosticHandler: diagnosticCollector, |
185 beforeRun: (Compiler compiler) { | 186 beforeRun: (Compiler compiler) { |
186 compiler.serialization.deserializer = | 187 compiler.serialization.deserializer = |
187 new _DeserializerSystem(deserializer); | 188 new _DeserializerSystem(deserializer); |
188 }); | 189 }); |
189 if (test != null) { | 190 if (test != null) { |
190 Expect.equals(test.expectedErrorCount, diagnosticCollector.errors.length, | 191 Expect.equals(test.expectedErrorCount, diagnosticCollector.errors.length, |
191 "Unexpected error count."); | 192 "Unexpected error count."); |
192 Expect.equals( | 193 Expect.equals( |
193 test.expectedWarningCount, | 194 test.expectedWarningCount, |
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
232 @override | 233 @override |
233 WorldImpact computeWorldImpact(Element element) { | 234 WorldImpact computeWorldImpact(Element element) { |
234 return const WorldImpact(); | 235 return const WorldImpact(); |
235 } | 236 } |
236 | 237 |
237 @override | 238 @override |
238 bool isDeserialized(Element element) { | 239 bool isDeserialized(Element element) { |
239 return deserializedLibraries.contains(element.library); | 240 return deserializedLibraries.contains(element.library); |
240 } | 241 } |
241 } | 242 } |
OLD | NEW |