| 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 51 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 62 | 62 |
| 63 /// Whether this stack frame comes from the Dart core libraries. | 63 /// Whether this stack frame comes from the Dart core libraries. |
| 64 bool get isCore => uri.scheme == 'dart'; | 64 bool get isCore => uri.scheme == 'dart'; |
| 65 | 65 |
| 66 /// Returns a human-friendly description of the library that this stack frame | 66 /// Returns a human-friendly description of the library that this stack frame |
| 67 /// comes from. | 67 /// comes from. |
| 68 /// | 68 /// |
| 69 /// This will usually be the string form of [uri], but a relative URI will be | 69 /// This will usually be the string form of [uri], but a relative URI will be |
| 70 /// used if possible. | 70 /// used if possible. |
| 71 String get library { | 71 String get library { |
| 72 if (uri.scheme != 'file') return uri.toString(); | 72 if (uri.scheme != Uri.base.scheme) return uri.toString(); |
| 73 if (path.style == path.Style.url) return path.relative(uri.toString()); |
| 73 return path.relative(path.fromUri(uri)); | 74 return path.relative(path.fromUri(uri)); |
| 74 } | 75 } |
| 75 | 76 |
| 76 /// Returns the name of the package this stack frame comes from, or `null` if | 77 /// Returns the name of the package this stack frame comes from, or `null` if |
| 77 /// this stack frame doesn't come from a `package:` URL. | 78 /// this stack frame doesn't come from a `package:` URL. |
| 78 String get package { | 79 String get package { |
| 79 if (uri.scheme != 'package') return null; | 80 if (uri.scheme != 'package') return null; |
| 80 return uri.path.split('/').first; | 81 return uri.path.split('/').first; |
| 81 } | 82 } |
| 82 | 83 |
| (...skipping 161 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 244 // their stack frames. However, if we do get a relative path, we should | 245 // their stack frames. However, if we do get a relative path, we should |
| 245 // handle it gracefully. | 246 // handle it gracefully. |
| 246 if (uriOrPath.contains('\\')) return path.windows.toUri(uriOrPath); | 247 if (uriOrPath.contains('\\')) return path.windows.toUri(uriOrPath); |
| 247 return Uri.parse(uriOrPath); | 248 return Uri.parse(uriOrPath); |
| 248 } | 249 } |
| 249 | 250 |
| 250 Frame(this.uri, this.line, this.column, this.member); | 251 Frame(this.uri, this.line, this.column, this.member); |
| 251 | 252 |
| 252 String toString() => '$location in $member'; | 253 String toString() => '$location in $member'; |
| 253 } | 254 } |
| OLD | NEW |