Index: third_party/dart-packages/stack_trace/stack_trace/src/frame.dart |
diff --git a/sky/tests/resources/third_party/stack_trace/src/frame.dart b/third_party/dart-packages/stack_trace/stack_trace/src/frame.dart |
similarity index 93% |
copy from sky/tests/resources/third_party/stack_trace/src/frame.dart |
copy to third_party/dart-packages/stack_trace/stack_trace/src/frame.dart |
index 9da1dc790ce8be79c62b23c7aa88577d18de7d5a..c06fd6034f45f898e745129904593356dd4ea6a3 100644 |
--- a/sky/tests/resources/third_party/stack_trace/src/frame.dart |
+++ b/third_party/dart-packages/stack_trace/stack_trace/src/frame.dart |
@@ -5,13 +5,14 @@ |
library frame; |
-import '../../path/path.dart' as path; |
+import 'package:path/path.dart' as path; |
import 'trace.dart'; |
// #1 Foo._bar (file:///home/nweiz/code/stuff.dart:42:21) |
-final _vmFrame = new RegExp( |
- r'^#\d+\s+(\S.*) \((.+?):(\d+)(?::(\d+))?\)$'); |
+// #1 Foo._bar (file:///home/nweiz/code/stuff.dart:42) |
+// #1 Foo._bar (file:///home/nweiz/code/stuff.dart) |
+final _vmFrame = new RegExp(r'^#\d+\s+(\S.*) \((.+?)((?::\d+){0,2})\)$'); |
// at VW.call$0 (http://pub.dartlang.org/stuff.dart.js:560:28) |
// at VW.call$0 (eval as fn |
@@ -56,6 +57,10 @@ final _firefoxSafariFrame = new RegExp( |
final _friendlyFrame = new RegExp( |
r'^(\S+)(?: (\d+)(?::(\d+))?)?\s+([^\d]\S*)$'); |
+/// A regular expression that matches asynchronous member names generated by the |
+/// VM. |
+final _asyncBody = new RegExp(r'<(<anonymous closure>|[^>]+)_async_body>'); |
+ |
final _initialDot = new RegExp(r"^\."); |
/// A single stack frame. Each frame points to a precise location in Dart code. |
@@ -135,14 +140,14 @@ class 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 member = match[1] |
+ .replaceAll(_asyncBody, "<async>") |
+ .replaceAll("<anonymous closure>", "<fn>"); |
var uri = Uri.parse(match[2]); |
- var line = int.parse(match[3]); |
- var column = null; |
- var columnMatch = match[4]; |
- if (columnMatch != null) { |
- column = int.parse(columnMatch); |
- } |
+ |
+ var lineAndColumn = match[3].split(':'); |
+ var line = lineAndColumn.length > 1 ? int.parse(lineAndColumn[1]) : null; |
+ var column = lineAndColumn.length > 2 ? int.parse(lineAndColumn[2]) : null; |
return new Frame(uri, line, column, member); |
} |