From 12f86e6f2f5e7a5fc4ea61f3c63c790be100688f Mon Sep 17 00:00:00 2001 From: Patrick Walton Date: Thu, 2 Jun 2011 11:27:35 -0700 Subject: [PATCH] rustc: Print node IDs for more types of nodes --- src/comp/pretty/pprust.rs | 27 +++++++++++++++++++++++++++ 1 file changed, 27 insertions(+) diff --git a/src/comp/pretty/pprust.rs b/src/comp/pretty/pprust.rs index 43165cf1b3a..532bb6e75cc 100644 --- a/src/comp/pretty/pprust.rs +++ b/src/comp/pretty/pprust.rs @@ -439,6 +439,15 @@ fn print_item(&ps s, &@ast::item item) { bclose(s, item.span); } } + + // Print the node ID if necessary. TODO: type as well. + alt (s.mode) { + case (mo_identified) { + space(s.s); + synth_comment(s, uint::to_str(ty::item_ann(item).id, 10u)); + } + case (_) { /* no-op */ } + } } fn print_stmt(&ps s, &ast::stmt st) { @@ -473,6 +482,15 @@ fn print_block(&ps s, ast::block blk) { case (_) {} } bclose(s, blk.span); + + // Print the node ID if necessary: TODO: type as well. + alt (s.mode) { + case (mo_identified) { + space(s.s); + synth_comment(s, "block " + uint::to_str(blk.node.a.id, 10u)); + } + case (_) { /* no-op */ } + } } fn print_literal(&ps s, &@ast::lit lit) { @@ -977,6 +995,15 @@ fn print_pat(&ps s, &@ast::pat pat) { } } } + + // Print the node ID if necessary. TODO: type as well. + alt (s.mode) { + case (mo_identified) { + space(s.s); + synth_comment(s, uint::to_str(ty::pat_ann(pat).id, 10u)); + } + case (_) { /* no-op */ } + } } fn print_fn(&ps s, ast::fn_decl decl, ast::proto proto, str name,