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 import 'dart:collection' show HashSet, Queue; | 5 import 'dart:collection' show HashSet, Queue; |
6 import 'dart:convert' show JSON; | 6 import 'dart:convert' show JSON; |
7 import 'dart:io' show File; | 7 import 'dart:io' show File; |
8 | 8 |
9 import 'package:analyzer/analyzer.dart' | 9 import 'package:analyzer/analyzer.dart' |
10 show AnalysisError, CompilationUnit, ErrorSeverity; | 10 show AnalysisError, CompilationUnit, ErrorSeverity; |
(...skipping 584 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
595 | 595 |
596 for (int i = 0; i < list.length; i++) { | 596 for (int i = 0; i < list.length; i++) { |
597 list[i] = transformUri(list[i]); | 597 list[i] = transformUri(list[i]); |
598 } | 598 } |
599 map['file'] = transformUri(map['file']); | 599 map['file'] = transformUri(map['file']); |
600 return map; | 600 return map; |
601 } | 601 } |
602 | 602 |
603 /// Cleanup the dart_sdk source map. | 603 /// Cleanup the dart_sdk source map. |
604 /// | 604 /// |
605 /// Strip out files that should not be included in the sdk sourcemap as they | |
606 /// are implementation details that would just confuse users. | |
607 /// Normalize sdk urls to use "dart:" for more understandable stack traces. | 605 /// Normalize sdk urls to use "dart:" for more understandable stack traces. |
608 Map cleanupSdkSourcemap(Map sourceMap) { | 606 Map cleanupSdkSourcemap(Map sourceMap) { |
609 var map = new Map.from(sourceMap); | 607 var map = new Map.from(sourceMap); |
610 map['sources'] = map['sources'] | 608 map['sources'] = map['sources'].map((url) { |
611 .map((url) => url.contains('/_internal/') ? null : url) | 609 var urlPrefix = '../../../gen/patched_sdk/lib/'; |
612 .toList(); | 610 if (!url.startsWith(urlPrefix)) throw new Error('Unexpected sdk url: $url'); |
| 611 return 'dart:${url.substring(urlPrefix.length)}'; |
| 612 }).toList(); |
613 return map; | 613 return map; |
614 } | 614 } |
OLD | NEW |