File tree Expand file tree Collapse file tree 6 files changed +68
-0
lines changed
_fe_analyzer_shared/lib/src/debug_helpers Expand file tree Collapse file tree 6 files changed +68
-0
lines changed Original file line number Diff line number Diff line change 1+ // Copyright (c) 2025, the Dart project authors. Please see the AUTHORS file
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.
4+
5+ export 'print.dart' ;
6+ export 'stack_trace.dart' ;
Original file line number Diff line number Diff line change 1+ // Copyright (c) 2025, the Dart project authors. Please see the AUTHORS file
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.
4+
5+ int _indentLevel = 0 ;
6+
7+ /// Prints the `toString()` of [value] to stdout.
8+ ///
9+ /// This supports automatic indentation when used with [debugPrintEnd] ,
10+ /// [debugPrintStart] and [inDebugPrint] .
11+ void debugPrint (Object value) {
12+ _debugPrint (value);
13+ }
14+
15+ /// Prints the `toString()` of [value] using [debugPrint] and increases the
16+ /// indentation level used by [debugPrint] .
17+ void debugPrintEnd (Object value) {
18+ _indentLevel-- ;
19+ _debugPrint (value);
20+ }
21+
22+ /// Decreases the indentation level used by [debugPrint] and prints the
23+ /// `toString()` of [value] using [debugPrint] .
24+ void debugPrintStart (Object value) {
25+ _debugPrint (value);
26+ _indentLevel++ ;
27+ }
28+
29+ /// Wraps the call to [f] with a start and end message containing the
30+ /// `toString()` of [value] , increasing the indentation level during the call
31+ /// to [f] .
32+ ///
33+ /// This can be used for easily printing call stacks for debugging.
34+ void inDebugPrint (Object value, void Function () f) {
35+ debugPrintStart ('start:$value ' );
36+ try {
37+ f ();
38+ } finally {
39+ debugPrintEnd ('end :$value ' );
40+ }
41+ }
42+
43+ void _debugPrint (Object value) {
44+ print ('${' ' * _indentLevel }${value }' );
45+ }
Original file line number Diff line number Diff line change 1+ // Copyright (c) 2025, the Dart project authors. Please see the AUTHORS file
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.
4+
5+ // Reexport debug helpers to make them easily available inside package:analyzer.
6+ export 'package:_fe_analyzer_shared/src/debug_helpers/debug_helpers.dart' ;
Original file line number Diff line number Diff line change 1+ // Copyright (c) 2025, the Dart project authors. Please see the AUTHORS file
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.
4+
5+ // Reexport debug helpers to make them easily available inside
6+ // package:front_end.
7+ export 'package:_fe_analyzer_shared/src/debug_helpers/debug_helpers.dart' ;
Original file line number Diff line number Diff line change 22# for details. All rights reserved. Use of this source code is governed by a
33# BSD-style license that can be found in the LICENSE file.
44
5+ _fe_analyzer_shared/lib/src/debug_helpers/debug_helpers/Exports: Fail
56_fe_analyzer_shared/lib/src/metadata/ast/Exports: Fail
67_fe_analyzer_shared/lib/src/parser/parser/Exports: Fail
78_fe_analyzer_shared/lib/src/scanner/scanner/Exports: Fail
@@ -20,6 +21,7 @@ front_end/lib/src/api_prototype/testing/Exports: Fail
2021front_end/lib/src/api_prototype/try_constant_evaluator/Exports: Fail
2122front_end/lib/src/base/messages/Exports: Fail
2223front_end/lib/src/codes/cfe_codes/Exports: Fail
24+ front_end/lib/src/debug_helpers/Exports: Fail
2325front_end/lib/src/testing/id_testing_helper/Exports: Fail
2426kernel/lib/ast/Exports: Fail
2527kernel/lib/kernel/Exports: Fail
Original file line number Diff line number Diff line change @@ -118,6 +118,7 @@ augments
118118author
119119auto
120120automagically
121+ automatic
121122auxiliary
122123averages
123124awaited
@@ -1485,6 +1486,7 @@ redirections
14851486redirector
14861487redo
14871488reevaluation
1489+ reexport
14881490reexports
14891491ref
14901492refactoring
You can’t perform that action at this time.
0 commit comments