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 arguments.forEachTest(serializedData, TESTS, checkModels); | 35 await 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 | |
52 String testDescription = test != null ? test.name : '${entryPoint}'; | 47 String testDescription = test != null ? test.name : '${entryPoint}'; |
53 String id = index != null ? '$index: ' : ''; | 48 String id = index != null ? '$index: ' : ''; |
54 print('------------------------------------------------------------------'); | 49 print('------------------------------------------------------------------'); |
55 print('compile normal ${id}${testDescription}'); | 50 print('compile normal ${id}${testDescription}'); |
56 print('------------------------------------------------------------------'); | 51 print('------------------------------------------------------------------'); |
57 Compiler compilerNormal = compilerFor( | 52 Compiler compilerNormal = compilerFor( |
58 memorySourceFiles: sourceFiles, | 53 memorySourceFiles: sourceFiles, |
59 options: [Flags.analyzeOnly]); | 54 options: [Flags.analyzeOnly]); |
60 compilerNormal.resolution.retainCachesForTesting = true; | 55 compilerNormal.resolution.retainCachesForTesting = true; |
61 await compilerNormal.run(entryPoint); | 56 await compilerNormal.run(entryPoint); |
(...skipping 218 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
280 return true; | 275 return true; |
281 } | 276 } |
282 | 277 |
283 String nodeToString(Node node) { | 278 String nodeToString(Node node) { |
284 String text = '$node'; | 279 String text = '$node'; |
285 if (text.length > 40) { | 280 if (text.length > 40) { |
286 return '(${node.runtimeType}) ${text.substring(0, 37)}...'; | 281 return '(${node.runtimeType}) ${text.substring(0, 37)}...'; |
287 } | 282 } |
288 return '(${node.runtimeType}) $text'; | 283 return '(${node.runtimeType}) $text'; |
289 } | 284 } |
OLD | NEW |