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 command_line_config; | 5 library command_line_config; |
6 | 6 |
7 import 'dart:io'; | 7 import 'dart:io'; |
8 import 'dart:math' as math; | 8 import 'dart:math' as math; |
9 | 9 |
10 import 'package:pathos/path.dart' as path; | 10 import 'package:pathos/path.dart' as path; |
(...skipping 88 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
99 | 99 |
100 var result = new StringBuffer(); | 100 var result = new StringBuffer(); |
101 result.write(string); | 101 result.write(string); |
102 for (var i = 0; i < length - string.length; i++) { | 102 for (var i = 0; i < length - string.length; i++) { |
103 result.write(' '); | 103 result.write(' '); |
104 } | 104 } |
105 | 105 |
106 return result.toString(); | 106 return result.toString(); |
107 } | 107 } |
108 | 108 |
109 String _indent(String str) { | 109 String _indent(String str) => |
110 // TODO(nweiz): Use this simpler code once issue 2980 is fixed. | 110 str.replaceAll(new RegExp("^", multiLine: true), " "); |
111 // return str.replaceAll(new RegExp("^", multiLine: true), " "); | |
112 return str.split("\n").map((line) => " $line").join("\n"); | |
113 } | |
114 } | 111 } |
115 | 112 |
116 class _StackFrame { | 113 class _StackFrame { |
117 static final fileRegExp = new RegExp( | 114 static final fileRegExp = new RegExp( |
118 r'#\d+\s+(.*) \(file://(/.+):(\d+):(\d+)\)'); | 115 r'#\d+\s+(.*) \(file://(/.+):(\d+):(\d+)\)'); |
119 static final coreRegExp = new RegExp(r'#\d+\s+(.*) \((.+):(\d+):(\d+)\)'); | 116 static final coreRegExp = new RegExp(r'#\d+\s+(.*) \((.+):(\d+):(\d+)\)'); |
120 | 117 |
121 /// If `true`, then this stack frame is for a library built into Dart and | 118 /// If `true`, then this stack frame is for a library built into Dart and |
122 /// not a regular file path. | 119 /// not a regular file path. |
123 final bool isCore; | 120 final bool isCore; |
(...skipping 30 matching lines...) Expand all Loading... |
154 var library = match[2]; | 151 var library = match[2]; |
155 if (!isCore) { | 152 if (!isCore) { |
156 // Make the library path relative to the entrypoint. | 153 // Make the library path relative to the entrypoint. |
157 library = path.relative(library); | 154 library = path.relative(library); |
158 } | 155 } |
159 | 156 |
160 var member = match[1].replaceAll("<anonymous closure>", _lambda); | 157 var member = match[1].replaceAll("<anonymous closure>", _lambda); |
161 return new _StackFrame._(isCore, library, match[3], match[4], member); | 158 return new _StackFrame._(isCore, library, match[3], match[4], member); |
162 } | 159 } |
163 } | 160 } |
OLD | NEW |