Skip to content

Commit 0834cd9

Browse files
committed
---
yaml --- r: 42433 b: refs/heads/try c: 3ea3136 h: refs/heads/master i: 42431: 05b16cd v: v3
1 parent b40b47e commit 0834cd9

File tree

9 files changed

+110
-67
lines changed

9 files changed

+110
-67
lines changed

[refs]

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
refs/heads/master: 19dfec2aaf746535de1521f68421f9980dbf25de
33
refs/heads/snap-stage1: e33de59e47c5076a89eadeb38f4934f58a3618a6
44
refs/heads/snap-stage3: 2f46b763da2c098913884f101b6d71d69af41b49
5-
refs/heads/try: 0b9e23146b75c02dd9059dc754070884595f3104
5+
refs/heads/try: 3ea3136e84659773fea9e6f89cb7ddf76cee2324
66
refs/tags/release-0.1: 1f5c5126e96c79d22cb7862f75304136e204f105
77
refs/heads/ndm: f3868061cd7988080c30d6d5bf352a5a5fe2460b
88
refs/heads/try2: a810c03263670238bccd64cabb12a23a46e3a278

branches/try/src/libsyntax/ast.rs

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -313,11 +313,13 @@ type blk = spanned<blk_>;
313313

314314
#[auto_encode]
315315
#[auto_decode]
316-
type blk_ = {view_items: ~[@view_item],
317-
stmts: ~[@stmt],
318-
expr: Option<@expr>,
319-
id: node_id,
320-
rules: blk_check_mode};
316+
struct blk_ {
317+
view_items: ~[@view_item],
318+
stmts: ~[@stmt],
319+
expr: Option<@expr>,
320+
id: node_id,
321+
rules: blk_check_mode,
322+
}
321323

322324
#[auto_encode]
323325
#[auto_decode]

branches/try/src/libsyntax/ast_util.rs

Lines changed: 12 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -289,10 +289,18 @@ fn block_from_expr(e: @expr) -> blk {
289289
return spanned {node: blk_, span: e.span};
290290
}
291291

292-
fn default_block(+stmts1: ~[@stmt], expr1: Option<@expr>, id1: node_id) ->
293-
blk_ {
294-
{view_items: ~[], stmts: stmts1,
295-
expr: expr1, id: id1, rules: default_blk}
292+
fn default_block(
293+
+stmts1: ~[@stmt],
294+
expr1: Option<@expr>,
295+
id1: node_id
296+
) -> blk_ {
297+
ast::blk_ {
298+
view_items: ~[],
299+
stmts: stmts1,
300+
expr: expr1,
301+
id: id1,
302+
rules: default_blk,
303+
}
296304
}
297305

298306
fn ident_to_path(s: span, +i: ident) -> @path {

branches/try/src/libsyntax/ext/auto_encode.rs

Lines changed: 20 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -356,21 +356,29 @@ priv impl ext_ctxt {
356356
}
357357

358358
fn blk(span: span, stmts: ~[@ast::stmt]) -> ast::blk {
359-
ast::spanned { node: { view_items: ~[],
360-
stmts: stmts,
361-
expr: None,
362-
id: self.next_id(),
363-
rules: ast::default_blk},
364-
span: span }
359+
ast::spanned {
360+
node: ast::blk_ {
361+
view_items: ~[],
362+
stmts: stmts,
363+
expr: None,
364+
id: self.next_id(),
365+
rules: ast::default_blk,
366+
},
367+
span: span,
368+
}
365369
}
366370

367371
fn expr_blk(expr: @ast::expr) -> ast::blk {
368-
ast::spanned { node: { view_items: ~[],
369-
stmts: ~[],
370-
expr: Some(expr),
371-
id: self.next_id(),
372-
rules: ast::default_blk},
373-
span: expr.span }
372+
ast::spanned {
373+
node: ast::blk_ {
374+
view_items: ~[],
375+
stmts: ~[],
376+
expr: Some(expr),
377+
id: self.next_id(),
378+
rules: ast::default_blk,
379+
},
380+
span: expr.span,
381+
}
374382
}
375383

376384
fn expr_path(span: span, strs: ~[ast::ident]) -> @ast::expr {

branches/try/src/libsyntax/ext/build.rs

Lines changed: 28 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -196,39 +196,45 @@ fn mk_local(cx: ext_ctxt, sp: span, mutbl: bool,
196196
let decl = ast::spanned {node: ast::decl_local(~[local]), span: sp};
197197
@ast::spanned { node: ast::stmt_decl(@decl, cx.next_id()), span: sp }
198198
}
199-
fn mk_block(cx: ext_ctxt, sp: span,
199+
fn mk_block(cx: ext_ctxt, span: span,
200200
view_items: ~[@ast::view_item],
201201
stmts: ~[@ast::stmt],
202202
expr: Option<@ast::expr>) -> @ast::expr {
203-
let blk = ast::spanned { node: { view_items: view_items,
204-
stmts: stmts,
205-
expr: expr,
206-
id: cx.next_id(),
207-
rules: ast::default_blk },
208-
span: sp };
209-
mk_expr(cx, sp, ast::expr_block(blk))
210-
}
211-
fn mk_block_(cx: ext_ctxt, sp: span, +stmts: ~[@ast::stmt]) -> ast::blk {
203+
let blk = ast::spanned {
204+
node: ast::blk_ {
205+
view_items: view_items,
206+
stmts: stmts,
207+
expr: expr,
208+
id: cx.next_id(),
209+
rules: ast::default_blk,
210+
},
211+
span: span,
212+
};
213+
mk_expr(cx, span, ast::expr_block(blk))
214+
}
215+
fn mk_block_(cx: ext_ctxt, span: span, +stmts: ~[@ast::stmt]) -> ast::blk {
212216
ast::spanned {
213-
node: {
217+
node: ast::blk_ {
214218
view_items: ~[],
215-
stmts: move stmts,
219+
stmts: stmts,
216220
expr: None,
217221
id: cx.next_id(),
218-
rules: ast::default_blk
222+
rules: ast::default_blk,
219223
},
220-
span: sp
224+
span: span,
221225
}
222226
}
223227
fn mk_simple_block(cx: ext_ctxt, span: span, expr: @ast::expr) -> ast::blk {
224-
let block = {
225-
view_items: ~[],
226-
stmts: ~[],
227-
expr: Some(expr),
228-
id: cx.next_id(),
229-
rules: ast::default_blk
230-
};
231-
ast::spanned { node: block, span: span }
228+
ast::spanned {
229+
node: ast::blk_ {
230+
view_items: ~[],
231+
stmts: ~[],
232+
expr: Some(expr),
233+
id: cx.next_id(),
234+
rules: ast::default_blk,
235+
},
236+
span: span,
237+
}
232238
}
233239
fn mk_copy(cx: ext_ctxt, sp: span, e: @ast::expr) -> @ast::expr {
234240
mk_expr(cx, sp, ast::expr_copy(e))

branches/try/src/libsyntax/ext/pipes/ast_builder.rs

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -193,11 +193,13 @@ impl ext_ctxt: ext_ctxt_ast_builder {
193193
}
194194

195195
fn block(+stmts: ~[@ast::stmt], e: @ast::expr) -> ast::blk {
196-
let blk = {view_items: ~[],
197-
stmts: stmts,
198-
expr: Some(e),
199-
id: self.next_id(),
200-
rules: ast::default_blk};
196+
let blk = ast::blk_ {
197+
view_items: ~[],
198+
stmts: stmts,
199+
expr: Some(e),
200+
id: self.next_id(),
201+
rules: ast::default_blk,
202+
};
201203

202204
spanned { node: blk, span: dummy_sp() }
203205
}

branches/try/src/libsyntax/fold.rs

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -319,11 +319,13 @@ fn noop_fold_method(&&m: @method, fld: ast_fold) -> @method {
319319

320320

321321
fn noop_fold_block(b: blk_, fld: ast_fold) -> blk_ {
322-
return {view_items: vec::map(b.view_items, |x| fld.fold_view_item(*x)),
323-
stmts: vec::map(b.stmts, |x| fld.fold_stmt(*x)),
324-
expr: option::map(&b.expr, |x| fld.fold_expr(*x)),
325-
id: fld.new_id(b.id),
326-
rules: b.rules};
322+
ast::blk_ {
323+
view_items: b.view_items.map(|x| fld.fold_view_item(*x)),
324+
stmts: b.stmts.map(|x| fld.fold_stmt(*x)),
325+
expr: b.expr.map(|x| fld.fold_expr(*x)),
326+
id: fld.new_id(b.id),
327+
rules: b.rules,
328+
}
327329
}
328330

329331
fn noop_fold_stmt(s: stmt_, fld: ast_fold) -> stmt_ {

branches/try/src/libsyntax/parse/classify.rs

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -30,8 +30,9 @@ fn expr_requires_semi_to_be_stmt(e: @ast::expr) -> bool {
3030

3131
fn expr_is_simple_block(e: @ast::expr) -> bool {
3232
match e.node {
33-
ast::expr_block(ast::spanned {node: {rules: ast::default_blk, _}, _}) =>
34-
true,
33+
ast::expr_block(
34+
ast::spanned { node: ast::blk_ { rules: ast::default_blk, _ }, _ }
35+
) => true,
3536
_ => false
3637
}
3738
}

branches/try/src/libsyntax/parse/parser.rs

Lines changed: 25 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1574,8 +1574,13 @@ impl Parser {
15741574
let lo = self.last_span.lo;
15751575
let (decl, captures) = parse_decl();
15761576
let body = parse_body();
1577-
let fakeblock = {view_items: ~[], stmts: ~[], expr: Some(body),
1578-
id: self.get_id(), rules: default_blk};
1577+
let fakeblock = ast::blk_ {
1578+
view_items: ~[],
1579+
stmts: ~[],
1580+
expr: Some(body),
1581+
id: self.get_id(),
1582+
rules: default_blk,
1583+
};
15791584
let fakeblock = spanned(body.span.lo, body.span.hi,
15801585
fakeblock);
15811586
return self.mk_expr(lo, body.span.hi,
@@ -1753,12 +1758,16 @@ impl Parser {
17531758
self.eat(token::COMMA);
17541759
}
17551760
1756-
let blk = spanned { node: { view_items: ~[],
1757-
stmts: ~[],
1758-
expr: Some(expr),
1759-
id: self.get_id(),
1760-
rules: default_blk},
1761-
span: expr.span };
1761+
let blk = spanned {
1762+
node: ast::blk_ {
1763+
view_items: ~[],
1764+
stmts: ~[],
1765+
expr: Some(expr),
1766+
id: self.get_id(),
1767+
rules: default_blk,
1768+
},
1769+
span: expr.span,
1770+
};
17621771
17631772
arms.push({pats: pats, guard: guard, body: blk});
17641773
}
@@ -2378,9 +2387,14 @@ impl Parser {
23782387
}
23792388
let mut hi = self.span.hi;
23802389
self.bump();
2381-
let bloc = {view_items: view_items, stmts: stmts, expr: expr,
2382-
id: self.get_id(), rules: s};
2383-
return spanned(lo, hi, bloc);
2390+
let bloc = ast::blk_ {
2391+
view_items: view_items,
2392+
stmts: stmts,
2393+
expr: expr,
2394+
id: self.get_id(),
2395+
rules: s,
2396+
};
2397+
spanned(lo, hi, bloc)
23842398
}
23852399

23862400
fn mk_ty_path(i: ident) -> @Ty {

0 commit comments

Comments
 (0)