Skip to content

Commit 8667bb8

Browse files
committed
---
yaml --- r: 127398 b: refs/heads/auto c: 8a80e0f h: refs/heads/master v: v3
1 parent bce3dd3 commit 8667bb8

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
@@ -13,7 +13,7 @@ refs/heads/try3: 9387340aab40a73e8424c48fd42f0c521a4875c0
1313
refs/tags/release-0.3.1: 495bae036dfe5ec6ceafd3312b4dca48741e845b
1414
refs/tags/release-0.4: e828ea2080499553b97dfe33b3f4d472b4562ad7
1515
refs/tags/release-0.5: 7e3bcfbf21278251ee936ad53e92e9b719702d73
16-
refs/heads/auto: a9b1a3b40f29795d5f049e342ec4a494e83125e9
16+
refs/heads/auto: 8a80e0fdab93cb6fb9eeb592857b8eeb35d14f15
1717
refs/heads/servo: af82457af293e2a842ba6b7759b70288da276167
1818
refs/tags/release-0.6: b4ebcfa1812664df5e142f0134a5faea3918544c
1919
refs/tags/0.1: b19db808c2793fe2976759b85a355c3ad8c8b336

branches/auto/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)