Skip to content

Commit d4f52e3

Browse files
committed
---
yaml --- r: 3263 b: refs/heads/master c: 97cf57a h: refs/heads/master i: 3261: cd35c26 3259: dd2f729 3255: d48e210 3247: b78b945 3231: 5551c55 3199: a260665 v: v3
1 parent a2dc458 commit d4f52e3

File tree

4 files changed

+14
-10
lines changed

4 files changed

+14
-10
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: 200dbe4c4fb291f9d6753ca394553981a84eb6b8
2+
refs/heads/master: 97cf57adc138cab1657104389dea905642744960

trunk/src/comp/middle/trans.rs

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,3 @@
1-
2-
31
// trans.rs: Translate the completed AST to the LLVM IR.
42
//
53
// Some functions here, such as trans_block and trans_expr, return a value --

trunk/src/comp/pretty/ppaux.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -235,7 +235,7 @@ fn print_comment(&ps s, lexer::cmnt cmnt) {
235235
zerobreak(s.s);
236236
}
237237
case (lexer::isolated) {
238-
hardbreak(s.s);
238+
pprust::hardbreak_if_not_eof(s);
239239
for (str line in cmnt.lines) { word(s.s, line); hardbreak(s.s); }
240240
}
241241
case (lexer::trailing) {

trunk/src/comp/pretty/pprust.rs

Lines changed: 12 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -120,6 +120,12 @@ fn bclose(&ps s, common::span span) {
120120

121121
}
122122

123+
fn hardbreak_if_not_eof(&ps s) {
124+
if (s.s.last_token() != pp::EOF) {
125+
hardbreak(s.s);
126+
}
127+
}
128+
123129
fn space_if_not_hardbreak(&ps s) {
124130
if (s.s.last_token() != pp::hardbreak_tok()) {
125131
space(s.s);
@@ -177,7 +183,7 @@ fn print_mod(&ps s, ast::_mod _mod) {
177183
for (@ast::item item in _mod.items) {
178184
// Mod-level item printing we're a little more space-y about.
179185

180-
hardbreak(s.s);
186+
hardbreak_if_not_eof(s);
181187
print_item(s, item);
182188
}
183189
print_remaining_comments(s);
@@ -265,7 +271,7 @@ fn print_type(&ps s, &ast::ty ty) {
265271
}
266272

267273
fn print_item(&ps s, &@ast::item item) {
268-
hardbreak(s.s);
274+
hardbreak_if_not_eof(s);
269275
maybe_print_comment(s, item.span.lo);
270276
print_outer_attributes(s, item.attrs);
271277
alt (item.node) {
@@ -867,7 +873,7 @@ fn print_decl(&ps s, &@ast::decl decl) {
867873
maybe_print_comment(s, decl.span.lo);
868874
alt (decl.node) {
869875
case (ast::decl_local(?loc)) {
870-
space(s.s);
876+
space_if_not_hardbreak(s);
871877
ibox(s, indent_unit);
872878
alt (loc.node.ty) {
873879
case (some(?ty)) {
@@ -985,7 +991,7 @@ fn print_fn_args_and_ret(&ps s, &ast::fn_decl decl) {
985991
pclose(s);
986992
maybe_print_comment(s, decl.output.span.lo);
987993
if (decl.output.node != ast::ty_nil) {
988-
space(s.s);
994+
space_if_not_hardbreak(s);
989995
word_space(s, "->");
990996
print_type(s, *decl.output);
991997
}
@@ -1017,7 +1023,7 @@ fn print_meta_item(&ps s, &@ast::meta_item item) {
10171023
}
10181024

10191025
fn print_view_item(&ps s, &@ast::view_item item) {
1020-
hardbreak(s.s);
1026+
hardbreak_if_not_eof(s);
10211027
maybe_print_comment(s, item.span.lo);
10221028
alt (item.node) {
10231029
case (ast::view_item_use(?id, ?mta, _, _)) {
@@ -1122,7 +1128,7 @@ fn print_ty_fn(&ps s, &ast::proto proto, &option::t[str] id,
11221128
pclose(s);
11231129
maybe_print_comment(s, output.span.lo);
11241130
if (output.node != ast::ty_nil) {
1125-
space(s.s);
1131+
space_if_not_hardbreak(s);
11261132
ibox(s, indent_unit);
11271133
word_space(s, "->");
11281134
alt (cf) {

0 commit comments

Comments
 (0)