Skip to content

Commit c64069d

Browse files
committed
---
yaml --- r: 4161 b: refs/heads/master c: a6260eb h: refs/heads/master i: 4159: 72678da v: v3
1 parent ee66613 commit c64069d

File tree

2 files changed

+20
-21
lines changed

2 files changed

+20
-21
lines changed

[refs]

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,2 @@
11
---
2-
refs/heads/master: 557c2a380ac0b59397a194ceaaaa0b4cc94d8851
2+
refs/heads/master: a6260ebaa2b3ba6c13cd6bc6d6cbbbe5b7c96595

trunk/src/comp/syntax/print/pprust.rs

Lines changed: 19 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -410,9 +410,9 @@ fn print_item(&ps s, &@ast::item item) {
410410
alt (item.node) {
411411
case (ast::item_const(?ty, ?expr)) {
412412
head(s, "const");
413+
word_space(s, item.ident + ":");
413414
print_type(s, *ty);
414415
space(s.s);
415-
word_space(s, item.ident);
416416
end(s); // end the head-ibox
417417

418418
word_space(s, "=");
@@ -442,6 +442,9 @@ fn print_item(&ps s, &@ast::item item) {
442442
case (ast::native_abi_rust_intrinsic) {
443443
word_nbsp(s, "\"rust-intrinsic\"");
444444
}
445+
case (ast::native_abi_x86stdcall) {
446+
word_nbsp(s, "\"x86stdcall\"");
447+
}
445448
}
446449
word_nbsp(s, "mod");
447450
word_nbsp(s, item.ident);
@@ -510,9 +513,8 @@ fn print_item(&ps s, &@ast::item item) {
510513
fn print_field(&ps s, &ast::obj_field field) {
511514
ibox(s, indent_unit);
512515
print_mutability(s, field.mut);
516+
word_space(s, field.ident + ":");
513517
print_type(s, *field.ty);
514-
space(s.s);
515-
word(s.s, field.ident);
516518
end(s);
517519
}
518520
fn get_span(&ast::obj_field f) -> codemap::span { ret f.ty.span; }
@@ -544,9 +546,8 @@ fn print_item(&ps s, &@ast::item item) {
544546
word(s.s, item.ident);
545547
print_type_params(s, tps);
546548
popen(s);
549+
word_space(s, dt.decl.inputs.(0).ident + ":");
547550
print_type(s, *dt.decl.inputs.(0).ty);
548-
space(s.s);
549-
word(s.s, dt.decl.inputs.(0).ident);
550551
pclose(s);
551552
space(s.s);
552553
print_block(s, dt.body);
@@ -810,23 +811,19 @@ fn print_expr(&ps s, &@ast::expr expr) {
810811
}
811812
case (ast::expr_for(?decl, ?expr, ?blk)) {
812813
head(s, "for");
813-
popen(s);
814814
print_for_decl(s, decl);
815815
space(s.s);
816816
word_space(s, "in");
817817
print_expr(s, expr);
818-
pclose(s);
819818
space(s.s);
820819
print_block(s, blk);
821820
}
822821
case (ast::expr_for_each(?decl, ?expr, ?blk)) {
823822
head(s, "for each");
824-
popen(s);
825823
print_for_decl(s, decl);
826824
space(s.s);
827825
word_space(s, "in");
828826
print_expr(s, expr);
829-
pclose(s);
830827
space(s.s);
831828
print_block(s, blk);
832829
}
@@ -869,10 +866,8 @@ fn print_expr(&ps s, &@ast::expr expr) {
869866
}
870867
case (ast::expr_block(?blk)) {
871868
// containing cbox, will be closed by print-block at }
872-
873869
cbox(s, indent_unit);
874870
// head-box, will be closed by print-block after {
875-
876871
ibox(s, 0u);
877872
print_block(s, blk);
878873
}
@@ -1008,9 +1003,9 @@ fn print_expr(&ps s, &@ast::expr expr) {
10081003
fn print_field(&ps s, &ast::anon_obj_field field) {
10091004
ibox(s, indent_unit);
10101005
print_mutability(s, field.mut);
1006+
word_space(s, field.ident + ":");
10111007
print_type(s, *field.ty);
10121008
space(s.s);
1013-
word(s.s, field.ident);
10141009
word_space(s, "=");
10151010
print_expr(s, field.expr);
10161011
end(s);
@@ -1067,8 +1062,7 @@ fn print_decl(&ps s, &@ast::decl decl) {
10671062
alt loc.node.ty {
10681063
some(?ty) {
10691064
ibox(s, indent_unit);
1070-
word(s.s, loc.node.ident);
1071-
word_space(s, ":");
1065+
word_space(s, loc.node.ident + ":");
10721066
print_type(s, *ty);
10731067
end(s);
10741068
}
@@ -1100,16 +1094,20 @@ fn print_decl(&ps s, &@ast::decl decl) {
11001094
fn print_ident(&ps s, &ast::ident ident) { word(s.s, ident); }
11011095

11021096
fn print_for_decl(&ps s, @ast::local loc) {
1097+
word(s.s, loc.node.ident);
11031098
alt (loc.node.ty) {
1104-
none { word(s.s, "auto"); }
1105-
some (?t) { print_type(s, *t); }
1099+
some (?t) {
1100+
word_space(s, ":");
1101+
print_type(s, *t);
1102+
}
1103+
none {}
11061104
}
11071105
space(s.s);
1108-
word(s.s, loc.node.ident);
11091106
}
11101107

11111108
fn print_path(&ps s, &ast::path path) {
11121109
maybe_print_comment(s, path.span.lo);
1110+
if path.node.global { word(s.s, "::"); }
11131111
auto first = true;
11141112
for (str id in path.node.idents) {
11151113
if (first) { first = false; } else { word(s.s, "::"); }
@@ -1128,14 +1126,16 @@ fn print_pat(&ps s, &@ast::pat pat) {
11281126
s.ann.pre(ann_node);
11291127
alt (pat.node) {
11301128
case (ast::pat_wild) { word(s.s, "_"); }
1131-
case (ast::pat_bind(?id)) { word(s.s, "?" + id); }
1129+
case (ast::pat_bind(?id)) { word(s.s, id); }
11321130
case (ast::pat_lit(?lit)) { print_literal(s, lit); }
11331131
case (ast::pat_tag(?path, ?args)) {
11341132
print_path(s, path);
11351133
if (ivec::len(args) > 0u) {
11361134
popen(s);
11371135
commasep(s, inconsistent, args, print_pat);
11381136
pclose(s);
1137+
} else {
1138+
word(s.s, ".");
11391139
}
11401140
}
11411141
case (ast::pat_rec(?fields, ?etc)) {
@@ -1182,10 +1182,9 @@ fn print_fn_args_and_ret(&ps s, &ast::fn_decl decl) {
11821182
popen(s);
11831183
fn print_arg(&ps s, &ast::arg x) {
11841184
ibox(s, indent_unit);
1185+
word_space(s, x.ident + ":");
11851186
print_alias(s, x.mode);
11861187
print_type(s, *x.ty);
1187-
space(s.s);
1188-
word(s.s, x.ident);
11891188
end(s);
11901189
}
11911190
commasep(s, inconsistent, decl.inputs, print_arg);

0 commit comments

Comments
 (0)