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_model_test; | 5 library dart2js.serialization_model_test; |
6 import 'dart:async'; | 6 import 'dart:async'; |
7 import 'dart:io'; | 7 import 'dart:io'; |
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/closure.dart'; | 10 import 'package:compiler/src/closure.dart'; |
(...skipping 14 matching lines...) Expand all Loading... |
25 Arguments arguments = new Arguments.from(args); | 25 Arguments arguments = new Arguments.from(args); |
26 SerializedData serializedData = | 26 SerializedData serializedData = |
27 await serializeDartCore(arguments: arguments); | 27 await serializeDartCore(arguments: arguments); |
28 if (arguments.filename != null) { | 28 if (arguments.filename != null) { |
29 Uri entryPoint = Uri.base.resolve(nativeToUriPath(arguments.filename)); | 29 Uri entryPoint = Uri.base.resolve(nativeToUriPath(arguments.filename)); |
30 await checkModels(entryPoint, | 30 await checkModels(entryPoint, |
31 sourceFiles: serializedData.toMemorySourceFiles(), | 31 sourceFiles: serializedData.toMemorySourceFiles(), |
32 resolutionInputs: serializedData.toUris()); | 32 resolutionInputs: serializedData.toUris()); |
33 } else { | 33 } else { |
34 Uri entryPoint = Uri.parse('memory:main.dart'); | 34 Uri entryPoint = Uri.parse('memory:main.dart'); |
35 await arguments.forEachTest(serializedData, TESTS, checkModels); | 35 arguments.forEachTest(serializedData, TESTS, checkModels); |
36 } | 36 } |
37 }); | 37 }); |
38 } | 38 } |
39 | 39 |
40 Future checkModels( | 40 Future checkModels( |
41 Uri entryPoint, | 41 Uri entryPoint, |
42 {Map<String, String> sourceFiles: const <String, String>{}, | 42 {Map<String, String> sourceFiles: const <String, String>{}, |
43 List<Uri> resolutionInputs, | 43 List<Uri> resolutionInputs, |
44 int index, | 44 int index, |
45 Test test, | 45 Test test, |
46 bool verbose: false}) async { | 46 bool verbose: false}) async { |
| 47 if (test != null && test.name == 'Disable tree shaking through reflection') { |
| 48 // TODO(johnniwinther): Support serialization of metadata. |
| 49 return; |
| 50 } |
| 51 |
47 String testDescription = test != null ? test.name : '${entryPoint}'; | 52 String testDescription = test != null ? test.name : '${entryPoint}'; |
48 String id = index != null ? '$index: ' : ''; | 53 String id = index != null ? '$index: ' : ''; |
49 print('------------------------------------------------------------------'); | 54 print('------------------------------------------------------------------'); |
50 print('compile normal ${id}${testDescription}'); | 55 print('compile normal ${id}${testDescription}'); |
51 print('------------------------------------------------------------------'); | 56 print('------------------------------------------------------------------'); |
52 Compiler compilerNormal = compilerFor( | 57 Compiler compilerNormal = compilerFor( |
53 memorySourceFiles: sourceFiles, | 58 memorySourceFiles: sourceFiles, |
54 options: [Flags.analyzeOnly]); | 59 options: [Flags.analyzeOnly]); |
55 compilerNormal.resolution.retainCachesForTesting = true; | 60 compilerNormal.resolution.retainCachesForTesting = true; |
56 await compilerNormal.run(entryPoint); | 61 await compilerNormal.run(entryPoint); |
(...skipping 218 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
275 return true; | 280 return true; |
276 } | 281 } |
277 | 282 |
278 String nodeToString(Node node) { | 283 String nodeToString(Node node) { |
279 String text = '$node'; | 284 String text = '$node'; |
280 if (text.length > 40) { | 285 if (text.length > 40) { |
281 return '(${node.runtimeType}) ${text.substring(0, 37)}...'; | 286 return '(${node.runtimeType}) ${text.substring(0, 37)}...'; |
282 } | 287 } |
283 return '(${node.runtimeType}) $text'; | 288 return '(${node.runtimeType}) $text'; |
284 } | 289 } |
OLD | NEW |