OLD | NEW |
(Empty) | |
| 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 |
| 3 // BSD-style license that can be found in the LICENSE file. |
| 4 |
| 5 import 'package:async_helper/async_helper.dart'; |
| 6 import 'package:expect/expect.dart'; |
| 7 import 'sourcemap_helper.dart'; |
| 8 import 'sourcemap_html_helper.dart'; |
| 9 import 'package:compiler/src/filenames.dart'; |
| 10 |
| 11 main(List<String> arguments) { |
| 12 bool showAll = false; |
| 13 Uri outputUri; |
| 14 if (arguments.isNotEmpty) { |
| 15 outputUri = Uri.base.resolve(nativeToUriPath(arguments.last)); |
| 16 showAll = arguments.contains('-a'); |
| 17 } |
| 18 asyncTest(() async { |
| 19 String filename = |
| 20 'tests/compiler/dart2js/sourcemaps/invokes_test_file.dart'; |
| 21 SourceMapProcessor processor = new SourceMapProcessor(filename); |
| 22 List<SourceMapInfo> infoList = await processor.process( |
| 23 ['--use-new-source-info', '--csp', '--disable-inlining']); |
| 24 List<SourceMapInfo> userInfoList = <SourceMapInfo>[]; |
| 25 List<SourceMapInfo> failureList = <SourceMapInfo>[]; |
| 26 for (SourceMapInfo info in infoList) { |
| 27 if (info.element.library.isPlatformLibrary) continue; |
| 28 userInfoList.add(info); |
| 29 Iterable<CodePoint> missingCodePoints = |
| 30 info.codePoints.where((c) => c.isMissing); |
| 31 if (!missingCodePoints.isEmpty) { |
| 32 print('Missing code points ${missingCodePoints} for ' |
| 33 '${info.element} in $filename'); |
| 34 failureList.add(info); |
| 35 } |
| 36 } |
| 37 if (failureList.isNotEmpty) { |
| 38 if (outputUri == null) { |
| 39 Expect.fail( |
| 40 "Missing code points found. " |
| 41 "Run the test with a URI option, `source_mapping_test <uri>`, to " |
| 42 "create a html visualization of the missing code points."); |
| 43 } else { |
| 44 createTraceSourceMapHtml(outputUri, processor, |
| 45 showAll ? userInfoList : failureList); |
| 46 } |
| 47 } else if (outputUri != null) { |
| 48 createTraceSourceMapHtml(outputUri, processor, userInfoList); |
| 49 } |
| 50 }); |
| 51 } |
OLD | NEW |