Skip to content

Commit b21778b

Browse files
committed
---
yaml --- r: 71907 b: refs/heads/dist-snap c: 441df26 h: refs/heads/master i: 71905: 02e198d 71903: ca43ca0 v: v3
1 parent 52cd77b commit b21778b

File tree

4 files changed

+511
-8
lines changed

4 files changed

+511
-8
lines changed

[refs]

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ refs/tags/release-0.1: 1f5c5126e96c79d22cb7862f75304136e204f105
77
refs/heads/ndm: f3868061cd7988080c30d6d5bf352a5a5fe2460b
88
refs/heads/try2: 147ecfdd8221e4a4d4e090486829a06da1e0ca3c
99
refs/heads/incoming: b50030718cf28f2a5a81857a26b57442734fe854
10-
refs/heads/dist-snap: 5841564bf9a9db012fc17d53da514ddf223dfaf5
10+
refs/heads/dist-snap: 441df26f5a1f76ed0ea185cca22c6b2c6e1307b1
1111
refs/tags/release-0.2: c870d2dffb391e14efb05aa27898f1f6333a9596
1212
refs/tags/release-0.3: b5f0d0f648d9a6153664837026ba1be43d3e2503
1313
refs/heads/try3: 9387340aab40a73e8424c48fd42f0c521a4875c0

branches/dist-snap/src/libsyntax/ext/build.rs

Lines changed: 53 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -279,10 +279,10 @@ pub fn mk_lambda_(cx: @ext_ctxt,
279279
mk_expr(cx, span, ast::expr_fn_block(fn_decl, blk))
280280
}
281281
pub fn mk_lambda(cx: @ext_ctxt,
282-
span: span,
283-
fn_decl: ast::fn_decl,
284-
expr: @ast::expr)
285-
-> @ast::expr {
282+
span: span,
283+
fn_decl: ast::fn_decl,
284+
expr: @ast::expr)
285+
-> @ast::expr {
286286
let blk = mk_simple_block(cx, span, expr);
287287
mk_lambda_(cx, span, fn_decl, blk)
288288
}
@@ -294,6 +294,13 @@ pub fn mk_lambda_stmts(cx: @ext_ctxt,
294294
let blk = mk_block(cx, span, ~[], stmts, None);
295295
mk_lambda(cx, span, fn_decl, blk)
296296
}
297+
pub fn mk_lambda_no_args(cx: @ext_ctxt,
298+
span: span,
299+
expr: @ast::expr)
300+
-> @ast::expr {
301+
let fn_decl = mk_fn_decl(~[], mk_ty_infer(cx, span));
302+
mk_lambda(cx, span, fn_decl, expr)
303+
}
297304
pub fn mk_copy(cx: @ext_ctxt, sp: span, e: @ast::expr) -> @ast::expr {
298305
mk_expr(cx, sp, ast::expr_copy(e))
299306
}
@@ -303,11 +310,20 @@ pub fn mk_managed(cx: @ext_ctxt, sp: span, e: @ast::expr) -> @ast::expr {
303310
pub fn mk_pat(cx: @ext_ctxt, span: span, +pat: ast::pat_) -> @ast::pat {
304311
@ast::pat { id: cx.next_id(), node: pat, span: span }
305312
}
313+
pub fn mk_pat_wild(cx: @ext_ctxt, span: span) -> @ast::pat {
314+
mk_pat(cx, span, ast::pat_wild)
315+
}
316+
pub fn mk_pat_lit(cx: @ext_ctxt,
317+
span: span,
318+
expr: @ast::expr) -> @ast::pat {
319+
mk_pat(cx, span, ast::pat_lit(expr))
320+
}
306321
pub fn mk_pat_ident(cx: @ext_ctxt,
307322
span: span,
308323
ident: ast::ident) -> @ast::pat {
309324
mk_pat_ident_with_binding_mode(cx, span, ident, ast::bind_by_copy)
310325
}
326+
311327
pub fn mk_pat_ident_with_binding_mode(cx: @ext_ctxt,
312328
span: span,
313329
ident: ast::ident,
@@ -435,8 +451,38 @@ pub fn mk_ty_param(cx: @ext_ctxt,
435451
}
436452
pub fn mk_lifetime(cx: @ext_ctxt,
437453
span: span,
438-
ident: ast::ident) -> ast::Lifetime
439-
{
454+
ident: ast::ident)
455+
-> ast::Lifetime {
440456
ast::Lifetime { id: cx.next_id(), span: span, ident: ident }
441457
}
442-
458+
pub fn mk_arm(cx: @ext_ctxt,
459+
span: span,
460+
pats: ~[@ast::pat],
461+
expr: @ast::expr)
462+
-> ast::arm {
463+
ast::arm {
464+
pats: pats,
465+
guard: None,
466+
body: mk_simple_block(cx, span, expr)
467+
}
468+
}
469+
pub fn mk_unreachable(cx: @ext_ctxt, span: span) -> @ast::expr {
470+
let loc = cx.codemap().lookup_char_pos(span.lo);
471+
mk_call_global(
472+
cx,
473+
span,
474+
~[
475+
cx.ident_of(~"core"),
476+
cx.ident_of(~"sys"),
477+
cx.ident_of(~"begin_unwind"),
478+
],
479+
~[
480+
mk_uniq_str(cx, span, ~"internal error: entered unreachable code"),
481+
mk_uniq_str(cx, span, loc.file.name),
482+
mk_uint(cx, span, loc.line),
483+
]
484+
)
485+
}
486+
pub fn mk_unreachable_arm(cx: @ext_ctxt, span: span) -> ast::arm {
487+
mk_arm(cx, span, ~[mk_pat_wild(cx, span)], mk_unreachable(cx, span))
488+
}

0 commit comments

Comments
 (0)