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

Side by Side Diff: lib/src/vm_trace.dart

Issue 912043002: Better suqpport for async VM frames. (Closed) Base URL: git@github.com:dart-lang/stack_trace@master
Patch Set: 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 unified diff | Download patch
« no previous file with comments | « lib/src/frame.dart ('k') | pubspec.yaml » ('j') | 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 vm_trace; 5 library vm_trace;
6 6
7 import 'frame.dart'; 7 import 'frame.dart';
8 import 'utils.dart'; 8 import 'utils.dart';
9 9
10 /// An implementation of [StackTrace] that emulates the behavior of the VM's 10 /// An implementation of [StackTrace] that emulates the behavior of the VM's
11 /// implementation. 11 /// implementation.
12 /// 12 ///
13 /// In particular, when [toString] is called, this returns a string in the VM's 13 /// In particular, when [toString] is called, this returns a string in the VM's
14 /// stack trace format. 14 /// stack trace format.
15 class VMTrace implements StackTrace { 15 class VMTrace implements StackTrace {
16 /// The stack frames that comprise this stack trace. 16 /// The stack frames that comprise this stack trace.
17 final List<Frame> frames; 17 final List<Frame> frames;
18 18
19 VMTrace(this.frames); 19 VMTrace(this.frames);
20 20
21 String toString() { 21 String toString() {
22 var i = 1; 22 var i = 1;
23 return frames.map((frame) { 23 return frames.map((frame) {
24 var number = padRight("#${i++}", 8); 24 var number = padRight("#${i++}", 8);
25 var member = frame.member.replaceAll("<fn>", "<anonymous closure>"); 25 var member = frame.member
26 .replaceAll("<fn>", "<anonymous closure>")
27 .replaceAll("<async>", "<<anonymous closure>_async_body>");
26 var line = frame.line == null ? 0 : frame.line; 28 var line = frame.line == null ? 0 : frame.line;
27 var column = frame.column == null ? 0 : frame.column; 29 var column = frame.column == null ? 0 : frame.column;
28 return "$number$member (${frame.uri}:$line:$column)\n"; 30 return "$number$member (${frame.uri}:$line:$column)\n";
29 }).join(); 31 }).join();
30 } 32 }
31 } 33 }
OLDNEW
« no previous file with comments | « lib/src/frame.dart ('k') | pubspec.yaml » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698