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

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

Issue 22880030: Fix a bad merge in pkg/stack_trace. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 7 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 | Annotate | Revision Log
« no previous file with comments | « no previous file | no next file » | 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:collection'; 7 import 'dart:collection';
8 import 'dart:math' as math; 8 import 'dart:math' as math;
9 9
10 import 'frame.dart'; 10 import 'frame.dart';
(...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after
75 return new LazyTrace(() => new Trace.parse(trace.toString())); 75 return new LazyTrace(() => new Trace.parse(trace.toString()));
76 } 76 }
77 77
78 /// Parses a string representation of a stack trace. 78 /// Parses a string representation of a stack trace.
79 /// 79 ///
80 /// [trace] should be formatted in the same way as a Dart VM or browser stack 80 /// [trace] should be formatted in the same way as a Dart VM or browser stack
81 /// trace. 81 /// trace.
82 factory Trace.parse(String trace) { 82 factory Trace.parse(String trace) {
83 try { 83 try {
84 if (trace.isEmpty) return new Trace(<Frame>[]); 84 if (trace.isEmpty) return new Trace(<Frame>[]);
85 if (trace.startsWith("Error\n")) return new Trace.parseV8(trace); 85 if (trace.contains(_v8Trace)) return new Trace.parseV8(trace);
86 // Valid Safari traces are a superset of valid Firefox traces. 86 // Valid Safari traces are a superset of valid Firefox traces.
87 if (trace.contains(_firefoxTrace)) return new Trace.parseFirefox(trace); 87 if (trace.contains(_firefoxTrace)) return new Trace.parseSafari(trace);
88 if (trace.contains(_friendlyTrace)) return new Trace.parseFriendly(trace); 88 if (trace.contains(_friendlyTrace)) return new Trace.parseFriendly(trace);
89 89
90 // Default to parsing the stack trace as a VM trace. This is also hit on 90 // Default to parsing the stack trace as a VM trace. This is also hit on
91 // IE and Safari, where the stack trace is just an empty string (issue 91 // IE and Safari, where the stack trace is just an empty string (issue
92 // 11257). 92 // 11257).
93 return new Trace.parseVM(trace); 93 return new Trace.parseVM(trace);
94 } on FormatException catch (error) { 94 } on FormatException catch (error) {
95 throw new FormatException('${error.message}\nStack trace:\n$trace'); 95 throw new FormatException('${error.message}\nStack trace:\n$trace');
96 } 96 }
97 } 97 }
(...skipping 89 matching lines...) Expand 10 before | Expand all | Expand 10 after
187 // Figure out the longest path so we know how much to pad. 187 // Figure out the longest path so we know how much to pad.
188 var longest = frames.map((frame) => frame.location.length) 188 var longest = frames.map((frame) => frame.location.length)
189 .fold(0, math.max); 189 .fold(0, math.max);
190 190
191 // Print out the stack trace nicely formatted. 191 // Print out the stack trace nicely formatted.
192 return frames.map((frame) { 192 return frames.map((frame) {
193 return '${padRight(frame.location, longest)} ${frame.member}\n'; 193 return '${padRight(frame.location, longest)} ${frame.member}\n';
194 }).join(); 194 }).join();
195 } 195 }
196 } 196 }
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698