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 part of dart2js.helpers; | 5 part of dart2js.helpers; |
6 | 6 |
7 /// Function signature for [trace]. | 7 /// Function signature for [trace]. |
8 typedef void Trace(String message, | 8 typedef void Trace(String message, |
9 {bool condition(String stackTrace), | 9 {bool condition(String stackTrace), |
10 int limit, | 10 int limit, |
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
46 stackTrace = '$s'; | 46 stackTrace = '$s'; |
47 } | 47 } |
48 if (condition != null) { | 48 if (condition != null) { |
49 if (!condition(stackTrace)) return; | 49 if (!condition(stackTrace)) return; |
50 } | 50 } |
51 print('$message\n$stackTrace'); | 51 print('$message\n$stackTrace'); |
52 if (throwOnPrint) throw message; | 52 if (throwOnPrint) throw message; |
53 } | 53 } |
54 } | 54 } |
55 | 55 |
56 traceExceptions(List<String> exceptions) { | |
karlklose
2015/06/08 09:05:30
Please add some documentation.
Johnni Winther
2015/06/08 09:36:14
Done.
| |
57 return (String stackTrace) { | |
58 return !exceptions.any((String exception) { | |
59 return stackTrace.contains(exception); | |
karlklose
2015/06/08 09:05:30
'return !exceptions.any(stackTrace.contains);'
Johnni Winther
2015/06/08 09:36:14
Done.
| |
60 }); | |
61 }; | |
62 } | |
63 | |
56 /// Function signature of [traceAndReport]. | 64 /// Function signature of [traceAndReport]. |
57 typedef void TraceAndReport(Compiler compiler, Spannable node, String message, | 65 typedef void TraceAndReport(Compiler compiler, Spannable node, String message, |
58 {bool condition(String stackTrace), int limit, | 66 {bool condition(String stackTrace), int limit, |
59 bool throwOnPrint}); | 67 bool throwOnPrint}); |
60 | 68 |
61 /// Calls [reportHere] and [trace] with the same message. | 69 /// Calls [reportHere] and [trace] with the same message. |
62 TraceAndReport get traceAndReport { | 70 TraceAndReport get traceAndReport { |
63 enableDebugMode(); | 71 enableDebugMode(); |
64 return _traceAndReport; | 72 return _traceAndReport; |
65 } | 73 } |
(...skipping 258 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
324 } | 332 } |
325 for (int index = text.length ; index < intendedLength ; index ++) { | 333 for (int index = text.length ; index < intendedLength ; index ++) { |
326 int dotsIndex = index % dotsLength; | 334 int dotsIndex = index % dotsLength; |
327 sb.write(dots.substring(dotsIndex, dotsIndex + 1)); | 335 sb.write(dots.substring(dotsIndex, dotsIndex + 1)); |
328 } | 336 } |
329 if (padLeft) { | 337 if (padLeft) { |
330 sb.write(text); | 338 sb.write(text); |
331 } | 339 } |
332 return sb.toString(); | 340 return sb.toString(); |
333 } | 341 } |
OLD | NEW |