diff options
| author | Graydon Hoare <graydon@mozilla.com> | 2011-06-03 15:26:03 -0700 |
|---|---|---|
| committer | Graydon Hoare <graydon@mozilla.com> | 2011-06-03 15:42:42 -0700 |
| commit | 088ab03fdbdd2fad29b678f5eeaadde4e15cb205 (patch) | |
| tree | 00a3a6b77754b9788cffe0bff534f2d6530f6dc2 /src/comp/pretty | |
| parent | 8235e76a473f6c650ad6a96dca0b5ef84ebdac4a (diff) | |
| download | rust-088ab03fdbdd2fad29b678f5eeaadde4e15cb205.tar.gz rust-088ab03fdbdd2fad29b678f5eeaadde4e15cb205.zip | |
Add spans to fields, args, methods. Improve pp of same.
Diffstat (limited to 'src/comp/pretty')
| -rw-r--r-- | src/comp/pretty/pprust.rs | 18 |
1 files changed, 8 insertions, 10 deletions
diff --git a/src/comp/pretty/pprust.rs b/src/comp/pretty/pprust.rs index f58c9fd45e4..dad990fe443 100644 --- a/src/comp/pretty/pprust.rs +++ b/src/comp/pretty/pprust.rs @@ -268,16 +268,13 @@ fn print_type(&ps s, &ast::ty ty) { popen(s); fn print_field(&ps s, &ast::ty_field f) { cbox(s, indent_unit); - print_mt(s, f.mt); + print_mt(s, f.node.mt); space(s.s); - word(s.s, f.ident); + word(s.s, f.node.ident); end(s); } fn get_span(&ast::ty_field f) -> common::span { - // Try to reconstruct the span for this field - auto sp = f.mt.ty.span; - auto hi = sp.hi + str::char_len(f.ident) + 1u; - ret rec(hi=hi with sp); + ret f.span; } auto f = print_field; auto gs = get_span; @@ -290,8 +287,9 @@ fn print_type(&ps s, &ast::ty ty) { for (ast::ty_method m in methods) { hardbreak(s.s); cbox(s, indent_unit); - print_ty_fn(s, m.proto, some(m.ident), - m.inputs, m.output, m.cf); + maybe_print_comment(s, m.span.lo); + print_ty_fn(s, m.node.proto, some(m.node.ident), + m.node.inputs, m.node.output, m.node.cf); word(s.s, ";"); end(s); } @@ -1217,8 +1215,8 @@ fn print_ty_fn(&ps s, &ast::proto proto, &option::t[str] id, zerobreak(s.s); popen(s); fn print_arg(&ps s, &ast::ty_arg input) { - if (input.mode == ast::alias) {word(s.s, "&");} - print_type(s, *input.ty); + if (input.node.mode == ast::alias) {word(s.s, "&");} + print_type(s, *input.node.ty); } auto f = print_arg; commasep[ast::ty_arg](s, inconsistent, inputs, f); |
