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

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

Issue 14009004: Remove methods on StackTrace class. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Add dart2j issue number for unexepected stack trace. Created 7 years, 8 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 | runtime/lib/stacktrace_patch.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 trace; 5 library trace;
6 6
7 import 'dart:uri'; 7 import 'dart:uri';
8 import 'dart:math' as math; 8 import 'dart:math' as math;
9 9
10 import 'frame.dart'; 10 import 'frame.dart';
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after
45 return new Trace(trace.frames.skip(level + 1)); 45 return new Trace(trace.frames.skip(level + 1));
46 } 46 }
47 } 47 }
48 48
49 /// Returns a new stack trace containing the same data as [trace]. 49 /// Returns a new stack trace containing the same data as [trace].
50 /// 50 ///
51 /// If [trace] is a native [StackTrace], its data will be parsed out; if it's 51 /// If [trace] is a native [StackTrace], its data will be parsed out; if it's
52 /// a [Trace], it will be returned as-is. 52 /// a [Trace], it will be returned as-is.
53 factory Trace.from(StackTrace trace) { 53 factory Trace.from(StackTrace trace) {
54 if (trace is Trace) return trace; 54 if (trace is Trace) return trace;
55 return new Trace.parse(trace.fullStackTrace); 55 return new Trace.parse(trace.toString());
56 } 56 }
57 57
58 /// Parses a string representation of a stack trace. 58 /// Parses a string representation of a stack trace.
59 /// 59 ///
60 /// [trace] should be formatted in the same way as native stack traces. 60 /// [trace] should be formatted in the same way as native stack traces.
61 Trace.parse(String trace) 61 Trace.parse(String trace)
62 : this(trace.trim().split("\n").map((line) => new Frame.parse(line))); 62 : this(trace.trim().split("\n").map((line) => new Frame.parse(line)));
63 63
64 /// Returns a new [Trace] comprised of [frames]. 64 /// Returns a new [Trace] comprised of [frames].
65 Trace(Iterable<Frame> frames) 65 Trace(Iterable<Frame> frames)
(...skipping 66 matching lines...) Expand 10 before | Expand all | Expand 10 after
132 if (string.length >= length) return string; 132 if (string.length >= length) return string;
133 133
134 var result = new StringBuffer(); 134 var result = new StringBuffer();
135 result.write(string); 135 result.write(string);
136 for (var i = 0; i < length - string.length; i++) { 136 for (var i = 0; i < length - string.length; i++) {
137 result.write(' '); 137 result.write(' ');
138 } 138 }
139 139
140 return result.toString(); 140 return result.toString();
141 } 141 }
OLDNEW
« no previous file with comments | « no previous file | runtime/lib/stacktrace_patch.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698