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 | 8 |
9 import '../../../pkg/path/lib/path.dart' as path; | 9 import '../../../pkg/path/lib/path.dart' as path; |
10 import '../../../pkg/unittest/lib/unittest.dart'; | 10 import '../../../pkg/unittest/lib/unittest.dart'; |
(...skipping 98 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
109 for (var i = 0; i < length - string.length; i++) { | 109 for (var i = 0; i < length - string.length; i++) { |
110 result.add(' '); | 110 result.add(' '); |
111 } | 111 } |
112 | 112 |
113 return result.toString(); | 113 return result.toString(); |
114 } | 114 } |
115 | 115 |
116 String _indent(String str) { | 116 String _indent(String str) { |
117 // TODO(nweiz): Use this simpler code once issue 2980 is fixed. | 117 // TODO(nweiz): Use this simpler code once issue 2980 is fixed. |
118 // return str.replaceAll(new RegExp("^", multiLine: true), " "); | 118 // return str.replaceAll(new RegExp("^", multiLine: true), " "); |
119 return Strings.join(str.split("\n").map((line) => " $line"), "\n"); | 119 return str.split("\n").map((line) => " $line").join("\n"); |
120 } | 120 } |
121 } | 121 } |
122 | 122 |
123 class _StackFrame { | 123 class _StackFrame { |
124 static final fileRegExp = new RegExp( | 124 static final fileRegExp = new RegExp( |
125 r'#\d+\s+(.*) \(file://(/.+):(\d+):(\d+)\)'); | 125 r'#\d+\s+(.*) \(file://(/.+):(\d+):(\d+)\)'); |
126 static final coreRegExp = new RegExp(r'#\d+\s+(.*) \((.+):(\d+):(\d+)\)'); | 126 static final coreRegExp = new RegExp(r'#\d+\s+(.*) \((.+):(\d+):(\d+)\)'); |
127 | 127 |
128 /// If `true`, then this stack frame is for a library built into Dart and | 128 /// If `true`, then this stack frame is for a library built into Dart and |
129 /// not a regular file path. | 129 /// not a regular file path. |
(...skipping 29 matching lines...) Expand all Loading... |
159 var library = match[2]; | 159 var library = match[2]; |
160 if (!isCore) { | 160 if (!isCore) { |
161 // Make the library path relative to the entrypoint. | 161 // Make the library path relative to the entrypoint. |
162 library = path.relative(library); | 162 library = path.relative(library); |
163 } | 163 } |
164 | 164 |
165 var member = match[1].replaceAll("<anonymous closure>", _lambda); | 165 var member = match[1].replaceAll("<anonymous closure>", _lambda); |
166 return new _StackFrame._(isCore, library, match[3], match[4], member); | 166 return new _StackFrame._(isCore, library, match[3], match[4], member); |
167 } | 167 } |
168 } | 168 } |
OLD | NEW |