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 import 'package:path/path.dart' as p; | |
6 | |
5 /// The line used in the string representation of stack chains to represent | 7 /// The line used in the string representation of stack chains to represent |
6 /// the gap between traces. | 8 /// the gap between traces. |
7 const chainGap = '===== asynchronous gap ===========================\n'; | 9 const chainGap = '===== asynchronous gap ===========================\n'; |
8 | 10 |
11 // TODO(nweiz): When cross-platform imports work, use them to set this. | |
12 /// Whether we're running in a JS context. | |
13 final bool inJS = p.style == p.Style.url; | |
kevmoo
2016/06/14 22:35:13
Could this cause problems for VM files loaded via
nweiz
2016/06/14 22:54:56
The URL that Dart code is loaded from doesn't affe
| |
14 | |
9 /// Returns [string] with enough spaces added to the end to make it [length] | 15 /// Returns [string] with enough spaces added to the end to make it [length] |
10 /// characters long. | 16 /// characters long. |
11 String padRight(String string, int length) { | 17 String padRight(String string, int length) { |
12 if (string.length >= length) return string; | 18 if (string.length >= length) return string; |
13 | 19 |
14 var result = new StringBuffer(); | 20 var result = new StringBuffer(); |
15 result.write(string); | 21 result.write(string); |
16 for (var i = 0; i < length - string.length; i++) { | 22 for (var i = 0; i < length - string.length; i++) { |
17 result.write(' '); | 23 result.write(' '); |
18 } | 24 } |
19 | 25 |
20 return result.toString(); | 26 return result.toString(); |
21 } | 27 } |
OLD | NEW |