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

Unified Diff: third_party/dart-packages/stack_trace/stack_trace/src/frame.dart

Issue 971083002: Create an apptesting framework for dart. (Closed) Base URL: https://github.com/domokit/mojo.git@master
Patch Set: Update upload_binaries.py to add the apptest.dartzip artifact. Created 5 years, 10 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
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);
}

Powered by Google App Engine
This is Rietveld 408576698