OLD | NEW |
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 frame; | 5 library frame; |
6 | 6 |
7 | 7 |
8 import 'package:path/path.dart' as path; | 8 import 'package:path/path.dart' as path; |
9 | 9 |
10 import 'trace.dart'; | 10 import 'trace.dart'; |
(...skipping 99 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
110 } | 110 } |
111 | 111 |
112 // Get the pieces out of the regexp match. Function, URI and line should | 112 // Get the pieces out of the regexp match. Function, URI and line should |
113 // always be found. The column is optional. | 113 // always be found. The column is optional. |
114 var member = match[1].replaceAll("<anonymous closure>", "<fn>"); | 114 var member = match[1].replaceAll("<anonymous closure>", "<fn>"); |
115 var uri = Uri.parse(match[2]); | 115 var uri = Uri.parse(match[2]); |
116 var line = int.parse(match[3]); | 116 var line = int.parse(match[3]); |
117 var column = null; | 117 var column = null; |
118 var columnMatch = match[4]; | 118 var columnMatch = match[4]; |
119 if (columnMatch != null) { | 119 if (columnMatch != null) { |
120 col = int.parse(columnMatch); | 120 column = int.parse(columnMatch); |
121 } | 121 } |
122 return new Frame(uri, line, col, member); | 122 return new Frame(uri, line, column, member); |
123 } | 123 } |
124 | 124 |
125 /// Parses a string representation of a Chrome/V8 stack frame. | 125 /// Parses a string representation of a Chrome/V8 stack frame. |
126 factory Frame.parseV8(String frame) { | 126 factory Frame.parseV8(String frame) { |
127 var match = _v8Frame.firstMatch(frame); | 127 var match = _v8Frame.firstMatch(frame); |
128 if (match == null) { | 128 if (match == null) { |
129 throw new FormatException("Couldn't parse V8 stack trace line '$frame'."); | 129 throw new FormatException("Couldn't parse V8 stack trace line '$frame'."); |
130 } | 130 } |
131 | 131 |
132 // V8 stack frames can be in two forms. | 132 // V8 stack frames can be in two forms. |
(...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
193 | 193 |
194 var line = match[2] == null ? null : int.parse(match[2]); | 194 var line = match[2] == null ? null : int.parse(match[2]); |
195 var column = match[3] == null ? null : int.parse(match[3]); | 195 var column = match[3] == null ? null : int.parse(match[3]); |
196 return new Frame(uri, line, column, match[4]); | 196 return new Frame(uri, line, column, match[4]); |
197 } | 197 } |
198 | 198 |
199 Frame(this.uri, this.line, this.column, this.member); | 199 Frame(this.uri, this.line, this.column, this.member); |
200 | 200 |
201 String toString() => '$location in $member'; | 201 String toString() => '$location in $member'; |
202 } | 202 } |
OLD | NEW |