Skip to content

Commit 12f86e6

Browse files
committed
rustc: Print node IDs for more types of nodes
1 parent 7c6a0f1 commit 12f86e6

File tree

1 file changed

+27
-0
lines changed

1 file changed

+27
-0
lines changed

src/comp/pretty/pprust.rs

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -439,6 +439,15 @@ fn print_item(&ps s, &@ast::item item) {
439439
bclose(s, item.span);
440440
}
441441
}
442+
443+
// Print the node ID if necessary. TODO: type as well.
444+
alt (s.mode) {
445+
case (mo_identified) {
446+
space(s.s);
447+
synth_comment(s, uint::to_str(ty::item_ann(item).id, 10u));
448+
}
449+
case (_) { /* no-op */ }
450+
}
442451
}
443452

444453
fn print_stmt(&ps s, &ast::stmt st) {
@@ -473,6 +482,15 @@ fn print_block(&ps s, ast::block blk) {
473482
case (_) {}
474483
}
475484
bclose(s, blk.span);
485+
486+
// Print the node ID if necessary: TODO: type as well.
487+
alt (s.mode) {
488+
case (mo_identified) {
489+
space(s.s);
490+
synth_comment(s, "block " + uint::to_str(blk.node.a.id, 10u));
491+
}
492+
case (_) { /* no-op */ }
493+
}
476494
}
477495

478496
fn print_literal(&ps s, &@ast::lit lit) {
@@ -977,6 +995,15 @@ fn print_pat(&ps s, &@ast::pat pat) {
977995
}
978996
}
979997
}
998+
999+
// Print the node ID if necessary. TODO: type as well.
1000+
alt (s.mode) {
1001+
case (mo_identified) {
1002+
space(s.s);
1003+
synth_comment(s, uint::to_str(ty::pat_ann(pat).id, 10u));
1004+
}
1005+
case (_) { /* no-op */ }
1006+
}
9801007
}
9811008

9821009
fn print_fn(&ps s, ast::fn_decl decl, ast::proto proto, str name,

0 commit comments

Comments
 (0)