Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(806)

Side by Side Diff: lib/src/util/stack_trace_mapper.dart

Issue 2184543002: Use the package_resolver package. (Closed) Base URL: git@github.com:dart-lang/test@master
Patch Set: Created 4 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « lib/src/util/io.dart ('k') | pubspec.yaml » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 import 'package:package_resolver/package_resolver.dart';
5 import 'package:source_map_stack_trace/source_map_stack_trace.dart' as mapper; 6 import 'package:source_map_stack_trace/source_map_stack_trace.dart' as mapper;
6 import 'package:source_maps/source_maps.dart'; 7 import 'package:source_maps/source_maps.dart';
7 8
8 /// A class for mapping JS stack traces to Dart stack traces using source maps. 9 /// A class for mapping JS stack traces to Dart stack traces using source maps.
9 class StackTraceMapper { 10 class StackTraceMapper {
10 /// The parsed source map. 11 /// The parsed source map.
11 final Mapping _mapping; 12 final Mapping _mapping;
12 13
13 /// The URI of the package root, as passed to dart2js. 14 /// The package resolution information passed to dart2js.
14 final Uri _packageRoot; 15 final SyncPackageResolver _packageResolver;
15 16
16 /// The URI of the SDK root from which dart2js loaded its sources. 17 /// The URI of the SDK root from which dart2js loaded its sources.
17 final Uri _sdkRoot; 18 final Uri _sdkRoot;
18 19
19 StackTraceMapper(String contents, {Uri mapUrl, Uri packageRoot, Uri sdkRoot}) 20 StackTraceMapper(String contents, {Uri mapUrl,
21 SyncPackageResolver packageResolver, Uri sdkRoot})
20 : _mapping = parse(contents, mapUrl: mapUrl), 22 : _mapping = parse(contents, mapUrl: mapUrl),
21 _packageRoot = packageRoot, 23 _packageResolver = packageResolver,
22 _sdkRoot = sdkRoot; 24 _sdkRoot = sdkRoot;
23 25
24 /// Converts [trace] into a Dart stack trace. 26 /// Converts [trace] into a Dart stack trace.
25 StackTrace mapStackTrace(StackTrace trace) => 27 StackTrace mapStackTrace(StackTrace trace) =>
26 mapper.mapStackTrace(_mapping, trace, 28 mapper.mapStackTrace(_mapping, trace,
27 packageRoot: _packageRoot, sdkRoot: _sdkRoot); 29 packageResolver: _packageResolver, sdkRoot: _sdkRoot);
28 } 30 }
OLDNEW
« no previous file with comments | « lib/src/util/io.dart ('k') | pubspec.yaml » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698