@@ -444,7 +444,6 @@ fn print_item(s: ps, &&item: @ast::item) {
444
444
print_outer_attributes(s, item.attrs);
445
445
let ann_node = node_item(s, item);
446
446
s.ann.pre(ann_node);
447
- print_visibility(s, item.vis);
448
447
match item.node {
449
448
ast::item_const(ty, expr) => {
450
449
head(s, visibility_qualified(item.vis, ~" const") ) ;
@@ -480,18 +479,18 @@ fn print_item(s: ps, &&item: @ast::item) {
480
479
ast::named => {
481
480
word_nbsp(s, ~" mod") ;
482
481
print_ident ( s, item. ident ) ;
482
+ nbsp ( s) ;
483
483
}
484
484
ast:: anonymous => { }
485
485
}
486
- nbsp ( s) ;
487
486
bopen ( s) ;
488
487
print_foreign_mod ( s, nmod, item. attrs ) ;
489
488
bclose ( s, item. span ) ;
490
489
}
491
490
ast:: item_ty ( ty, params) => {
492
491
ibox ( s, indent_unit) ;
493
492
ibox ( s, 0 u) ;
494
- word_nbsp ( s, ~"type ") ;
493
+ word_nbsp ( s, visibility_qualified ( item . vis , ~"type ") ) ;
495
494
print_ident ( s, item. ident ) ;
496
495
print_type_params ( s, params) ;
497
496
end ( s) ; // end the inner ibox
@@ -503,15 +502,15 @@ fn print_item(s: ps, &&item: @ast::item) {
503
502
end(s); // end the outer ibox
504
503
}
505
504
ast::item_enum(enum_definition, params) => {
506
- print_enum_def(s, enum_definition, params, item.ident, item.span);
505
+ print_enum_def(s, enum_definition, params, item.ident, item.span, item.vis );
507
506
}
508
507
ast::item_class(struct_def, tps) => {
509
- head(s, ~" struct") ;
508
+ head(s, visibility_qualified(item.vis, ~" struct") ) ;
510
509
print_struct ( s, struct_def, tps, item. ident , item. span ) ;
511
510
}
512
511
513
512
ast:: item_impl ( tps, opt_trait, ty, methods) => {
514
- head ( s, ~"impl ") ;
513
+ head ( s, visibility_qualified ( item . vis , ~"impl ") ) ;
515
514
if tps. is_not_empty ( ) {
516
515
print_type_params ( s, tps) ;
517
516
space ( s. s ) ;
@@ -534,7 +533,7 @@ fn print_item(s: ps, &&item: @ast::item) {
534
533
bclose ( s, item. span ) ;
535
534
}
536
535
ast:: item_trait ( tps, traits, methods) => {
537
- head ( s, ~"trait ") ;
536
+ head ( s, visibility_qualified ( item . vis , ~"trait ") ) ;
538
537
print_ident ( s, item. ident ) ;
539
538
print_type_params ( s, tps) ;
540
539
if vec:: len ( traits) != 0 u {
@@ -550,6 +549,7 @@ fn print_item(s: ps, &&item: @ast::item) {
550
549
bclose(s, item.span);
551
550
}
552
551
ast::item_mac({node: ast::mac_invoc_tt(pth, tts), _}) => {
552
+ print_visibility(s, item.vis);
553
553
print_path(s, pth, false);
554
554
word(s.s, ~" ! ");
555
555
print_ident(s, item.ident);
@@ -570,7 +570,7 @@ fn print_item(s: ps, &&item: @ast::item) {
570
570
571
571
fn print_enum_def ( s : ps , enum_definition : ast:: enum_def ,
572
572
params : ~[ ast:: ty_param ] , ident : ast:: ident ,
573
- span : ast:: span ) {
573
+ span : ast:: span , visibility : ast :: visibility ) {
574
574
let mut newtype =
575
575
vec:: len ( enum_definition. variants ) == 1 u &&
576
576
ident == enum_definition. variants [ 0 ] . node . name ;
@@ -582,9 +582,9 @@ fn print_enum_def(s: ps, enum_definition: ast::enum_def,
582
582
}
583
583
if newtype {
584
584
ibox ( s, indent_unit) ;
585
- word_space ( s, ~"enum ") ;
585
+ word_space ( s, visibility_qualified ( visibility , ~"enum ") ) ;
586
586
} else {
587
- head ( s, ~"enum ") ;
587
+ head ( s, visibility_qualified ( visibility , ~"enum ") ) ;
588
588
}
589
589
590
590
print_ident ( s, ident) ;
@@ -877,7 +877,7 @@ fn print_possibly_embedded_block_(s: ps, blk: ast::blk, embedded: embed_type,
877
877
indented: uint, attrs: ~[ast::attribute],
878
878
close_box: bool) {
879
879
match blk.node.rules {
880
- ast::unsafe_blk => word(s.s, ~" unsafe") ,
880
+ ast::unsafe_blk => word(s.s, ~" unsafe "),
881
881
ast::default_blk => ()
882
882
}
883
883
maybe_print_comment(s, blk.span.lo);
0 commit comments