librustc: De-`@mut` (and de-`@`) the pretty printer
This commit is contained in:
parent
4d66af2698
commit
b26018cc89
|
@ -517,20 +517,20 @@ impl pprust::pp_ann for IdentifiedAnnotation {
|
|||
fn post(&self, node: pprust::ann_node) {
|
||||
match node {
|
||||
pprust::node_item(s, item) => {
|
||||
pp::space(s.s);
|
||||
pp::space(&mut s.s);
|
||||
pprust::synth_comment(s, item.id.to_str());
|
||||
}
|
||||
pprust::node_block(s, ref blk) => {
|
||||
pp::space(s.s);
|
||||
pprust::node_block(s, blk) => {
|
||||
pp::space(&mut s.s);
|
||||
pprust::synth_comment(s, ~"block " + blk.id.to_str());
|
||||
}
|
||||
pprust::node_expr(s, expr) => {
|
||||
pp::space(s.s);
|
||||
pp::space(&mut s.s);
|
||||
pprust::synth_comment(s, expr.id.to_str());
|
||||
pprust::pclose(s);
|
||||
}
|
||||
pprust::node_pat(s, pat) => {
|
||||
pp::space(s.s);
|
||||
pp::space(&mut s.s);
|
||||
pprust::synth_comment(s, ~"pat " + pat.id.to_str());
|
||||
}
|
||||
}
|
||||
|
@ -552,10 +552,10 @@ impl pprust::pp_ann for TypedAnnotation {
|
|||
let tcx = self.analysis.ty_cx;
|
||||
match node {
|
||||
pprust::node_expr(s, expr) => {
|
||||
pp::space(s.s);
|
||||
pp::word(s.s, "as");
|
||||
pp::space(s.s);
|
||||
pp::word(s.s, ppaux::ty_to_str(tcx, ty::expr_ty(tcx, expr)));
|
||||
pp::space(&mut s.s);
|
||||
pp::word(&mut s.s, "as");
|
||||
pp::space(&mut s.s);
|
||||
pp::word(&mut s.s, ppaux::ty_to_str(tcx, ty::expr_ty(tcx, expr)));
|
||||
pprust::pclose(s);
|
||||
}
|
||||
_ => ()
|
||||
|
|
|
@ -118,7 +118,7 @@ impl<O:DataFlowOperator> pprust::pp_ann for DataFlowContext<O> {
|
|||
let comment_str = format!("id {}: {}{}{}",
|
||||
id, entry_str, gens_str, kills_str);
|
||||
pprust::synth_comment(ps, comment_str);
|
||||
pp::space(ps.s);
|
||||
pp::space(&mut ps.s);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -353,13 +353,13 @@ impl<O:DataFlowOperator+Clone+'static> DataFlowContext<O> {
|
|||
}
|
||||
|
||||
fn pretty_print_to(@self, wr: @mut io::Writer, blk: &ast::Block) {
|
||||
let ps = pprust::rust_printer_annotated(wr,
|
||||
self.tcx.sess.intr(),
|
||||
self as @pprust::pp_ann);
|
||||
pprust::cbox(ps, pprust::indent_unit);
|
||||
pprust::ibox(ps, 0u);
|
||||
pprust::print_block(ps, blk);
|
||||
pp::eof(ps.s);
|
||||
let mut ps = pprust::rust_printer_annotated(wr,
|
||||
self.tcx.sess.intr(),
|
||||
self as @pprust::pp_ann);
|
||||
pprust::cbox(&mut ps, pprust::indent_unit);
|
||||
pprust::ibox(&mut ps, 0u);
|
||||
pprust::print_block(&mut ps, blk);
|
||||
pp::eof(&mut ps.s);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -148,7 +148,7 @@ pub struct print_stack_elt {
|
|||
|
||||
pub static size_infinity: int = 0xffff;
|
||||
|
||||
pub fn mk_printer(out: @mut io::Writer, linewidth: uint) -> @mut Printer {
|
||||
pub fn mk_printer(out: @mut io::Writer, linewidth: uint) -> Printer {
|
||||
// Yes 3, it makes the ring buffers big enough to never
|
||||
// fall behind.
|
||||
let n: uint = 3 * linewidth;
|
||||
|
@ -156,7 +156,7 @@ pub fn mk_printer(out: @mut io::Writer, linewidth: uint) -> @mut Printer {
|
|||
let token: ~[token] = vec::from_elem(n, EOF);
|
||||
let size: ~[int] = vec::from_elem(n, 0);
|
||||
let scan_stack: ~[uint] = vec::from_elem(n, 0u);
|
||||
@mut Printer {
|
||||
Printer {
|
||||
out: out,
|
||||
buf_len: n,
|
||||
margin: linewidth as int,
|
||||
|
@ -557,47 +557,47 @@ impl Printer {
|
|||
// Convenience functions to talk to the printer.
|
||||
//
|
||||
// "raw box"
|
||||
pub fn rbox(p: @mut Printer, indent: uint, b: breaks) {
|
||||
pub fn rbox(p: &mut Printer, indent: uint, b: breaks) {
|
||||
p.pretty_print(BEGIN(begin_t {
|
||||
offset: indent as int,
|
||||
breaks: b
|
||||
}));
|
||||
}
|
||||
|
||||
pub fn ibox(p: @mut Printer, indent: uint) { rbox(p, indent, inconsistent); }
|
||||
pub fn ibox(p: &mut Printer, indent: uint) { rbox(p, indent, inconsistent); }
|
||||
|
||||
pub fn cbox(p: @mut Printer, indent: uint) { rbox(p, indent, consistent); }
|
||||
pub fn cbox(p: &mut Printer, indent: uint) { rbox(p, indent, consistent); }
|
||||
|
||||
pub fn break_offset(p: @mut Printer, n: uint, off: int) {
|
||||
pub fn break_offset(p: &mut Printer, n: uint, off: int) {
|
||||
p.pretty_print(BREAK(break_t {
|
||||
offset: off,
|
||||
blank_space: n as int
|
||||
}));
|
||||
}
|
||||
|
||||
pub fn end(p: @mut Printer) { p.pretty_print(END); }
|
||||
pub fn end(p: &mut Printer) { p.pretty_print(END); }
|
||||
|
||||
pub fn eof(p: @mut Printer) { p.pretty_print(EOF); }
|
||||
pub fn eof(p: &mut Printer) { p.pretty_print(EOF); }
|
||||
|
||||
pub fn word(p: @mut Printer, wrd: &str) {
|
||||
pub fn word(p: &mut Printer, wrd: &str) {
|
||||
p.pretty_print(STRING(/* bad */ wrd.to_managed(), wrd.len() as int));
|
||||
}
|
||||
|
||||
pub fn huge_word(p: @mut Printer, wrd: &str) {
|
||||
pub fn huge_word(p: &mut Printer, wrd: &str) {
|
||||
p.pretty_print(STRING(/* bad */ wrd.to_managed(), size_infinity));
|
||||
}
|
||||
|
||||
pub fn zero_word(p: @mut Printer, wrd: &str) {
|
||||
pub fn zero_word(p: &mut Printer, wrd: &str) {
|
||||
p.pretty_print(STRING(/* bad */ wrd.to_managed(), 0));
|
||||
}
|
||||
|
||||
pub fn spaces(p: @mut Printer, n: uint) { break_offset(p, n, 0); }
|
||||
pub fn spaces(p: &mut Printer, n: uint) { break_offset(p, n, 0); }
|
||||
|
||||
pub fn zerobreak(p: @mut Printer) { spaces(p, 0u); }
|
||||
pub fn zerobreak(p: &mut Printer) { spaces(p, 0u); }
|
||||
|
||||
pub fn space(p: @mut Printer) { spaces(p, 1u); }
|
||||
pub fn space(p: &mut Printer) { spaces(p, 1u); }
|
||||
|
||||
pub fn hardbreak(p: @mut Printer) { spaces(p, size_infinity as uint); }
|
||||
pub fn hardbreak(p: &mut Printer) { spaces(p, size_infinity as uint); }
|
||||
|
||||
pub fn hardbreak_tok_offset(off: int) -> token {
|
||||
BREAK(break_t {offset: off, blank_space: size_infinity})
|
||||
|
|
File diff suppressed because it is too large
Load Diff
Loading…
Reference in New Issue