Frame.parseVM constructor
Parses a string representation of a Dart VM stack frame.
Implementation
factory Frame.parseVM(String frame) => _catchFormatException(frame, () {
// The VM sometimes folds multiple stack frames together and replaces them
// with "...".
if (frame == '...') {
return new Frame(new Uri(), null, null, '...');
}
var match = _vmFrame.firstMatch(frame);
if (match == null) return new UnparsedFrame(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(_asyncBody, "<async>")
.replaceAll("<anonymous closure>", "<fn>");
var uri = Uri.parse(match[2]);
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);
});