| 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 76 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 87 return _reportHere; | 87 return _reportHere; |
| 88 } | 88 } |
| 89 | 89 |
| 90 /// Implementation of [reportHere] | 90 /// Implementation of [reportHere] |
| 91 _reportHere(DiagnosticReporter reporter, Spannable node, String debugMessage) { | 91 _reportHere(DiagnosticReporter reporter, Spannable node, String debugMessage) { |
| 92 reporter | 92 reporter |
| 93 .reportInfo(node, MessageKind.GENERIC, {'text': 'HERE: $debugMessage'}); | 93 .reportInfo(node, MessageKind.GENERIC, {'text': 'HERE: $debugMessage'}); |
| 94 } | 94 } |
| 95 | 95 |
| 96 /// Set of tracked objects used by [track] and [ifTracked]. | 96 /// Set of tracked objects used by [track] and [ifTracked]. |
| 97 var _trackedObjects = new Set(); | 97 var _trackedObjects = new Set<Object>(); |
| 98 | 98 |
| 99 /// Global default value for the `printTrace` option of [track] and [ifTracked]. | 99 /// Global default value for the `printTrace` option of [track] and [ifTracked]. |
| 100 bool trackWithTrace = false; | 100 bool trackWithTrace = false; |
| 101 | 101 |
| 102 /// If [doTrack] is `true`, add [object] to the set of tracked objects. | 102 /// If [doTrack] is `true`, add [object] to the set of tracked objects. |
| 103 /// | 103 /// |
| 104 /// If tracked, [message] is printed along the hash code and toString of | 104 /// If tracked, [message] is printed along the hash code and toString of |
| 105 /// [object]. If [printTrace] is `true` a trace printed additionally. | 105 /// [object]. If [printTrace] is `true` a trace printed additionally. |
| 106 /// If [printTrace] is `null`, [trackWithTrace] determines whether a trace is | 106 /// If [printTrace] is `null`, [trackWithTrace] determines whether a trace is |
| 107 /// printed. | 107 /// printed. |
| (...skipping 26 matching lines...) Expand all 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 |