File tree 1 file changed +8
-6
lines changed 1 file changed +8
-6
lines changed Original file line number Diff line number Diff line change @@ -1235,21 +1235,23 @@ pub fn type_to_str(x: Enum_CXTypeKind) -> String {
1235
1235
/// Dump the Clang AST to stdout for debugging purposes.
1236
1236
pub fn ast_dump ( c : & Cursor , depth : isize ) -> Enum_CXVisitorResult {
1237
1237
fn print_indent ( depth : isize , s : & str ) {
1238
- let mut i = 0 ;
1239
- while i < depth {
1238
+ for _ in 0 ..depth {
1240
1239
print ! ( "\t " ) ;
1241
- i += 1 ;
1242
1240
}
1243
1241
println ! ( "{}" , s) ;
1244
1242
}
1245
- let ct = c . cur_type ( ) . kind ( ) ;
1243
+
1246
1244
print_indent ( depth,
1247
- & format ! ( "({} {} {}" ,
1245
+ & format ! ( "(kind: {}, spelling: {}, type: {}" ,
1248
1246
kind_to_str( c. kind( ) ) ,
1249
1247
c. spelling( ) ,
1250
- type_to_str( ct) ) ) ;
1248
+ type_to_str( c. cur_type( ) . kind( ) ) ) ) ;
1249
+
1250
+ // Recurse.
1251
1251
c. visit ( |s| ast_dump ( & s, depth + 1 ) ) ;
1252
+
1252
1253
print_indent ( depth, ")" ) ;
1254
+
1253
1255
CXChildVisit_Continue
1254
1256
}
1255
1257
You can’t perform that action at this time.
0 commit comments