diff options
| author | Erick Tryzelaar <erick.tryzelaar@gmail.com> | 2013-02-17 10:59:09 -0800 |
|---|---|---|
| committer | Erick Tryzelaar <erick.tryzelaar@gmail.com> | 2013-02-19 10:02:51 -0800 |
| commit | bc62bd378251d6dd60f2999cd8c853a75a4e8d02 (patch) | |
| tree | 7f27b1abaab38625605525514b542f38d5968a11 /src/libsyntax/print | |
| parent | 59ba4fc1042bb83dc6899462649d70a0141ff8ca (diff) | |
| download | rust-bc62bd378251d6dd60f2999cd8c853a75a4e8d02.tar.gz rust-bc62bd378251d6dd60f2999cd8c853a75a4e8d02.zip | |
libsyntax: make enum variants take refs
Diffstat (limited to 'src/libsyntax/print')
| -rw-r--r-- | src/libsyntax/print/pprust.rs | 52 |
1 files changed, 35 insertions, 17 deletions
diff --git a/src/libsyntax/print/pprust.rs b/src/libsyntax/print/pprust.rs index d5cba4312b7..40ba27c495c 100644 --- a/src/libsyntax/print/pprust.rs +++ b/src/libsyntax/print/pprust.rs @@ -495,9 +495,16 @@ pub fn print_item(s: @ps, &&item: @ast::item) { end(s); // end the outer cbox } - ast::item_fn(decl, purity, typarams, ref body) => { - print_fn(s, decl, Some(purity), item.ident, typarams, None, - item.vis); + ast::item_fn(ref decl, purity, ref typarams, ref body) => { + print_fn( + s, + /* FIXME (#2543) */ copy *decl, + Some(purity), + item.ident, + /* FIXME (#2543) */ copy *typarams, + None, + item.vis + ); word(s.s, ~" "); print_block_with_attrs(s, (*body), item.attrs); } @@ -539,9 +546,15 @@ pub fn print_item(s: @ps, &&item: @ast::item) { word(s.s, ~";"); end(s); // end the outer ibox } - ast::item_enum(ref enum_definition, params) => { - print_enum_def(s, (*enum_definition), params, item.ident, - item.span, item.vis); + ast::item_enum(ref enum_definition, ref params) => { + print_enum_def( + s, + *enum_definition, + /* FIXME (#2543) */ copy *params, + item.ident, + item.span, + item.vis + ); } ast::item_struct(struct_def, tps) => { head(s, visibility_qualified(item.vis, ~"struct")); @@ -577,13 +590,13 @@ pub fn print_item(s: @ps, &&item: @ast::item) { bclose(s, item.span); } } - ast::item_trait(tps, traits, ref methods) => { + ast::item_trait(ref tps, ref traits, ref methods) => { head(s, visibility_qualified(item.vis, ~"trait")); print_ident(s, item.ident); - print_type_params(s, tps); - if vec::len(traits) != 0u { + print_type_params(s, /* FIXME (#2543) */ copy *tps); + if traits.len() != 0u { word(s.s, ~":"); - for vec::each(traits) |trait_| { + for traits.each |trait_| { nbsp(s); print_path(s, trait_.path, false); } @@ -619,7 +632,7 @@ pub fn print_enum_def(s: @ps, enum_definition: ast::enum_def, ident == enum_definition.variants[0].node.name; if newtype { match enum_definition.variants[0].node.kind { - ast::tuple_variant_kind(args) if args.len() == 1 => {} + ast::tuple_variant_kind(ref args) if args.len() == 1 => {} _ => newtype = false } } @@ -1325,24 +1338,24 @@ pub fn print_expr(s: @ps, &&expr: @ast::expr) { } bclose_(s, expr.span, match_indent_unit); } - ast::expr_fn(sigil, decl, ref body, _) => { + ast::expr_fn(sigil, ref decl, ref body, _) => { // containing cbox, will be closed by print-block at } cbox(s, indent_unit); // head-box, will be closed by print-block at start ibox(s, 0u); print_fn_header_info(s, None, None, ast::Many, Some(sigil), ast::inherited); - print_fn_args_and_ret(s, decl, None); + print_fn_args_and_ret(s, /* FIXME (#2543) */ copy *decl, None); space(s.s); print_block(s, (*body)); } - ast::expr_fn_block(decl, ref body) => { + ast::expr_fn_block(ref decl, ref body) => { // in do/for blocks we don't want to show an empty // argument list, but at this point we don't know which // we are inside. // // if !decl.inputs.is_empty() { - print_fn_block_args(s, decl); + print_fn_block_args(s, /* FIXME (#2543) */ copy *decl); space(s.s); // } assert (*body).node.stmts.is_empty(); @@ -1809,10 +1822,15 @@ pub fn print_meta_item(s: @ps, &&item: @ast::meta_item) { word_space(s, ~"="); print_literal(s, @value); } - ast::meta_list(ref name, items) => { + ast::meta_list(ref name, ref items) => { word(s.s, (*name)); popen(s); - commasep(s, consistent, items, print_meta_item); + commasep( + s, + consistent, + /* FIXME (#2543) */ copy *items, + print_meta_item + ); pclose(s); } } |
