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

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

Issue 29323004: Make stack frames without columns print correctly. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 7 years, 2 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 | Annotate | Revision Log
« no previous file with comments | « no previous file | pkg/stack_trace/test/frame_test.dart » ('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 7
8 import 'package:path/path.dart' as path; 8 import 'package:path/path.dart' as path;
9 9
10 import 'trace.dart'; 10 import 'trace.dart';
(...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after
71 71
72 /// Returns the name of the package this stack frame comes from, or `null` if 72 /// Returns the name of the package this stack frame comes from, or `null` if
73 /// this stack frame doesn't come from a `package:` URL. 73 /// this stack frame doesn't come from a `package:` URL.
74 String get package { 74 String get package {
75 if (uri.scheme != 'package') return null; 75 if (uri.scheme != 'package') return null;
76 return uri.path.split('/').first; 76 return uri.path.split('/').first;
77 } 77 }
78 78
79 /// A human-friendly description of the code location. 79 /// A human-friendly description of the code location.
80 String get location { 80 String get location {
81 if (line == null || column == null) return library; 81 if (line == null) return library;
82 if (column == null) return '$library $line';
82 return '$library $line:$column'; 83 return '$library $line:$column';
83 } 84 }
84 85
85 /// Returns a single frame of the current stack. 86 /// Returns a single frame of the current stack.
86 /// 87 ///
87 /// By default, this will return the frame above the current method. If 88 /// By default, this will return the frame above the current method. If
88 /// [level] is `0`, it will return the current method's frame; if [level] is 89 /// [level] is `0`, it will return the current method's frame; if [level] is
89 /// higher than `1`, it will return higher frames. 90 /// higher than `1`, it will return higher frames.
90 factory Frame.caller([int level=1]) { 91 factory Frame.caller([int level=1]) {
91 if (level < 0) { 92 if (level < 0) {
(...skipping 101 matching lines...) Expand 10 before | Expand all | Expand 10 after
193 194
194 var line = match[2] == null ? null : int.parse(match[2]); 195 var line = match[2] == null ? null : int.parse(match[2]);
195 var column = match[3] == null ? null : int.parse(match[3]); 196 var column = match[3] == null ? null : int.parse(match[3]);
196 return new Frame(uri, line, column, match[4]); 197 return new Frame(uri, line, column, match[4]);
197 } 198 }
198 199
199 Frame(this.uri, this.line, this.column, this.member); 200 Frame(this.uri, this.line, this.column, this.member);
200 201
201 String toString() => '$location in $member'; 202 String toString() => '$location in $member';
202 } 203 }
OLDNEW
« no previous file with comments | « no previous file | pkg/stack_trace/test/frame_test.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698