OLD | NEW |
1 // Copyright (c) 2014, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2014, 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 '../common.dart'; | 5 import '../common.dart'; |
6 import '../util/util.dart'; | 6 import '../util/util.dart'; |
7 | 7 |
8 /// Function signature for [trace]. | 8 /// Function signature for [trace]. |
9 typedef void Trace(String message, | 9 typedef void Trace(String message, |
10 {bool condition(String stackTrace), int limit, bool throwOnPrint}); | 10 {bool condition(String stackTrace), int limit, bool throwOnPrint}); |
(...skipping 119 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
130 // expression. The last case is used for async bodies. | 130 // expression. The last case is used for async bodies. |
131 for (String line in stackTrace.split('\n')) { | 131 for (String line in stackTrace.split('\n')) { |
132 try { | 132 try { |
133 index++; | 133 index++; |
134 if (rangeStart != null && index < rangeStart) continue; | 134 if (rangeStart != null && index < rangeStart) continue; |
135 if (rangeEnd != null && index > rangeEnd) break; | 135 if (rangeEnd != null && index > rangeEnd) break; |
136 if (line.isEmpty) continue; | 136 if (line.isEmpty) continue; |
137 | 137 |
138 // Strip index. | 138 // Strip index. |
139 line = line.replaceFirst(indexPattern, ''); | 139 line = line.replaceFirst(indexPattern, ''); |
| 140 if (line == '<asynchronous suspension>') { |
| 141 lines.add(new StackTraceLine(index, '', '', '', line)); |
| 142 continue; |
| 143 } |
140 | 144 |
141 int leftParenPos = line.indexOf('('); | 145 int leftParenPos = line.indexOf('('); |
142 int rightParenPos = line.indexOf(')', leftParenPos); | 146 int rightParenPos = line.indexOf(')', leftParenPos); |
143 int lastColon = line.lastIndexOf(':', rightParenPos); | 147 int lastColon = line.lastIndexOf(':', rightParenPos); |
144 int nextToLastColon = line.lastIndexOf(':', lastColon - 1); | 148 int nextToLastColon = line.lastIndexOf(':', lastColon - 1); |
145 | 149 |
146 String lineNo; | 150 String lineNo; |
147 String columnNo; | 151 String columnNo; |
148 if (nextToLastColon != -1) { | 152 if (nextToLastColon != -1) { |
149 lineNo = line.substring(nextToLastColon + 1, lastColon); | 153 lineNo = line.substring(nextToLastColon + 1, lastColon); |
(...skipping 188 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
338 } | 342 } |
339 for (int index = text.length; index < intendedLength; index++) { | 343 for (int index = text.length; index < intendedLength; index++) { |
340 int dotsIndex = index % dotsLength; | 344 int dotsIndex = index % dotsLength; |
341 sb.write(dots.substring(dotsIndex, dotsIndex + 1)); | 345 sb.write(dots.substring(dotsIndex, dotsIndex + 1)); |
342 } | 346 } |
343 if (padLeft) { | 347 if (padLeft) { |
344 sb.write(text); | 348 sb.write(text); |
345 } | 349 } |
346 return sb.toString(); | 350 return sb.toString(); |
347 } | 351 } |
OLD | NEW |