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

Side by Side Diff: lib/src/frame.dart

Issue 1320393003: Improve the display of data: URIs in stack traces. (Closed) Base URL: git@github.com:dart-lang/stack_trace@master
Patch Set: Created 5 years, 3 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 | « CHANGELOG.md ('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) 2013, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2013, 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 frame; 5 library frame;
6 6
7 import 'package:path/path.dart' as path; 7 import 'package:path/path.dart' as path;
8 8
9 import 'trace.dart'; 9 import 'trace.dart';
10 import 'unparsed_frame.dart'; 10 import 'unparsed_frame.dart';
(...skipping 77 matching lines...) Expand 10 before | Expand all | Expand 10 after
88 /// Anonymous closures are represented as `<fn>` in this member string. 88 /// Anonymous closures are represented as `<fn>` in this member string.
89 final String member; 89 final String member;
90 90
91 /// Whether this stack frame comes from the Dart core libraries. 91 /// Whether this stack frame comes from the Dart core libraries.
92 bool get isCore => uri.scheme == 'dart'; 92 bool get isCore => uri.scheme == 'dart';
93 93
94 /// Returns a human-friendly description of the library that this stack frame 94 /// Returns a human-friendly description of the library that this stack frame
95 /// comes from. 95 /// comes from.
96 /// 96 ///
97 /// This will usually be the string form of [uri], but a relative URI will be 97 /// This will usually be the string form of [uri], but a relative URI will be
98 /// used if possible. 98 /// used if possible. Data URIs will be truncated.
99 String get library => path.prettyUri(uri); 99 String get library {
100 if (uri.scheme == 'data') return "data:...";
101 return path.prettyUri(uri);
102 }
100 103
101 /// Returns the name of the package this stack frame comes from, or `null` if 104 /// Returns the name of the package this stack frame comes from, or `null` if
102 /// this stack frame doesn't come from a `package:` URL. 105 /// this stack frame doesn't come from a `package:` URL.
103 String get package { 106 String get package {
104 if (uri.scheme != 'package') return null; 107 if (uri.scheme != 'package') return null;
105 return uri.path.split('/').first; 108 return uri.path.split('/').first;
106 } 109 }
107 110
108 /// A human-friendly description of the code location. 111 /// A human-friendly description of the code location.
109 String get location { 112 String get location {
(...skipping 184 matching lines...) Expand 10 before | Expand all | Expand 10 after
294 return body(); 297 return body();
295 } on FormatException catch (_) { 298 } on FormatException catch (_) {
296 return new UnparsedFrame(text); 299 return new UnparsedFrame(text);
297 } 300 }
298 } 301 }
299 302
300 Frame(this.uri, this.line, this.column, this.member); 303 Frame(this.uri, this.line, this.column, this.member);
301 304
302 String toString() => '$location in $member'; 305 String toString() => '$location in $member';
303 } 306 }
OLDNEW
« no previous file with comments | « CHANGELOG.md ('k') | pubspec.yaml » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698