Skip to content

Commit cf843cf

Browse files
committed
---
yaml --- r: 128669 b: refs/heads/try c: 8a80e0f h: refs/heads/master i: 128667: 74b54bc v: v3
1 parent ee01fa3 commit cf843cf

File tree

2 files changed

+30
-1
lines changed

2 files changed

+30
-1
lines changed

[refs]

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
refs/heads/master: 07d86b46a949a94223da714e35b343243e4ecce4
33
refs/heads/snap-stage1: e33de59e47c5076a89eadeb38f4934f58a3618a6
44
refs/heads/snap-stage3: a86d9ad15e339ab343a12513f9c90556f677b9ca
5-
refs/heads/try: a9b1a3b40f29795d5f049e342ec4a494e83125e9
5+
refs/heads/try: 8a80e0fdab93cb6fb9eeb592857b8eeb35d14f15
66
refs/tags/release-0.1: 1f5c5126e96c79d22cb7862f75304136e204f105
77
refs/heads/ndm: f3868061cd7988080c30d6d5bf352a5a5fe2460b
88
refs/heads/try2: 147ecfdd8221e4a4d4e090486829a06da1e0ca3c

branches/try/src/libsyntax/ast_map/mod.rs

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@ use util::small_vector::SmallVector;
2121
use std::cell::RefCell;
2222
use std::fmt;
2323
use std::gc::{Gc, GC};
24+
use std::io::IoResult;
2425
use std::iter;
2526
use std::slice;
2627

@@ -819,6 +820,34 @@ pub fn map_decoded_item<F: FoldOps>(map: &Map,
819820
ii
820821
}
821822

823+
pub trait NodePrinter {
824+
fn print_node(&mut self, node: &Node) -> IoResult<()>;
825+
}
826+
827+
impl<'a> NodePrinter for pprust::State<'a> {
828+
fn print_node(&mut self, node: &Node) -> IoResult<()> {
829+
match *node {
830+
NodeItem(a) => self.print_item(&*a),
831+
NodeForeignItem(a) => self.print_foreign_item(&*a),
832+
NodeTraitMethod(a) => self.print_trait_method(&*a),
833+
NodeMethod(a) => self.print_method(&*a),
834+
NodeVariant(a) => self.print_variant(&*a),
835+
NodeExpr(a) => self.print_expr(&*a),
836+
NodeStmt(a) => self.print_stmt(&*a),
837+
NodePat(a) => self.print_pat(&*a),
838+
NodeBlock(a) => self.print_block(&*a),
839+
NodeLifetime(a) => self.print_lifetime(&*a),
840+
841+
// these cases do not carry enough information in the
842+
// ast_map to reconstruct their full structure for pretty
843+
// printing.
844+
NodeLocal(_) => fail!("cannot print isolated Local"),
845+
NodeArg(_) => fail!("cannot print isolated Arg"),
846+
NodeStructCtor(_) => fail!("cannot print isolated StructCtor"),
847+
}
848+
}
849+
}
850+
822851
fn node_id_to_string(map: &Map, id: NodeId) -> String {
823852
match map.find(id) {
824853
Some(NodeItem(item)) => {

0 commit comments

Comments
 (0)