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

Unified Diff: pkg/stack_trace/lib/src/frame.dart

Issue 23850014: - Use simplified token location call where appropriate. (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
Patch Set: Created 7 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | pkg/stack_trace/test/frame_test.dart » ('j') | pkg/stack_trace/test/frame_test.dart » ('J')
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: pkg/stack_trace/lib/src/frame.dart
===================================================================
--- pkg/stack_trace/lib/src/frame.dart (revision 27787)
+++ pkg/stack_trace/lib/src/frame.dart (working copy)
@@ -11,7 +11,7 @@
// #1 Foo._bar (file:///home/nweiz/code/stuff.dart:42:21)
final _vmFrame = new RegExp(
- r'^#\d+\s+([^\s].*) \((.+):(\d+):(\d+)\)$');
+ r'^#\d+\s+([^\s].*) \((.+?):(\d+)(?::(\d+))?\)$');
// at VW.call$0 (http://pub.dartlang.org/stuff.dart.js:560:28)
// at http://pub.dartlang.org/stuff.dart.js:560:28
@@ -109,9 +109,17 @@
throw new FormatException("Couldn't parse VM stack trace line '$frame'.");
}
+ // Get the pieces out of the regexp match. Function, URI and line should
+ // always be found. The column is optional.
+ var member = match[1].replaceAll("<anonymous closure>", "<fn>");
var uri = Uri.parse(match[2]);
- var member = match[1].replaceAll("<anonymous closure>", "<fn>");
- return new Frame(uri, int.parse(match[3]), int.parse(match[4]), member);
+ var line = int.parse(match[3]);
+ var col = null;
Bob Nystrom 2013/09/24 17:53:56 "col" -> "column".
Ivan Posva 2013/09/24 20:55:11 Done.
+ var col_match = match[4];
Bob Nystrom 2013/09/24 17:53:56 "col_match" -> "columnMatch".
nweiz 2013/09/24 20:16:03 This variable seems superfluous. Just use match[4]
Ivan Posva 2013/09/24 20:55:11 Done.
Ivan Posva 2013/09/24 20:55:11 Every time you access that same array element, you
nweiz 2013/09/24 20:57:11 I care about that a couple orders of magnitude les
+ if (col_match != null) {
+ col = int.parse(col_match);
+ }
+ return new Frame(uri, line, col, member);
}
/// Parses a string representation of a Chrome/V8 stack frame.
« no previous file with comments | « no previous file | pkg/stack_trace/test/frame_test.dart » ('j') | pkg/stack_trace/test/frame_test.dart » ('J')

Powered by Google App Engine
This is Rietveld 408576698