| 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 /// Library for debugging helpers. The unittest analyze_unused_test checks that | 5 /// Library for debugging helpers. The unittest analyze_unused_test checks that |
| 6 /// the helper are not used in production code. | 6 /// the helper are not used in production code. |
| 7 | 7 |
| 8 library dart2js.helpers; | 8 library dart2js.helpers; |
| 9 | 9 |
| 10 import '../common.dart'; | 10 import '../common.dart'; |
| (...skipping 22 matching lines...) Expand all Loading... |
| 33 | 33 |
| 34 class _DebugIndentation extends Indentation { | 34 class _DebugIndentation extends Indentation { |
| 35 final String indentationUnit = " "; | 35 final String indentationUnit = " "; |
| 36 } | 36 } |
| 37 | 37 |
| 38 _DebugIndentation _indentation = new _DebugIndentation(); | 38 _DebugIndentation _indentation = new _DebugIndentation(); |
| 39 | 39 |
| 40 /// Function signature of [debugPrint]. | 40 /// Function signature of [debugPrint]. |
| 41 typedef DebugPrint(s); | 41 typedef DebugPrint(s); |
| 42 | 42 |
| 43 /// If [DEBUG_PRINT_ENABLED] is `true` print [s] using the current identation. | 43 /// If [DEBUG_PRINT_ENABLED] is `true` print [s] using the current indentation. |
| 44 DebugPrint get debugPrint { | 44 DebugPrint get debugPrint { |
| 45 enableDebugMode(); | 45 enableDebugMode(); |
| 46 // TODO(johnniwinther): Maybe disable debug mode after the call. | 46 // TODO(johnniwinther): Maybe disable debug mode after the call. |
| 47 return _debugPrint; | 47 return _debugPrint; |
| 48 } | 48 } |
| 49 | 49 |
| 50 /// Implementation of [debugPrint]. | 50 /// Implementation of [debugPrint]. |
| 51 _debugPrint(s) { | 51 _debugPrint(s) { |
| 52 if (DEBUG_PRINT_ENABLED) print('${_indentation.indentation}$s'); | 52 if (DEBUG_PRINT_ENABLED) print('${_indentation.indentation}$s'); |
| 53 } | 53 } |
| (...skipping 80 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 134 if (printTrace) { | 134 if (printTrace) { |
| 135 trace(msg); | 135 trace(msg); |
| 136 } else { | 136 } else { |
| 137 debugPrint(msg); | 137 debugPrint(msg); |
| 138 } | 138 } |
| 139 } | 139 } |
| 140 return true; | 140 return true; |
| 141 } | 141 } |
| 142 return false; | 142 return false; |
| 143 } | 143 } |
| OLD | NEW |