Workaround for #4717: pad contents of ast. rs=breakage

This commit is contained in:
Niko Matsakis 2013-01-31 16:47:19 -08:00
parent 0682ad0eb9
commit 71478f9ce3
14 changed files with 22 additions and 17 deletions

View File

@ -510,7 +510,7 @@ fn mk_test_wrapper(cx: test_ctxt,
let wrapper_expr = ast::expr {
id: cx.sess.next_node_id(),
callee_id: cx.sess.next_node_id(),
node: ast::expr_fn(ast::ProtoBare, wrapper_decl, wrapper_body),
node: ast::expr_fn(ast::ProtoBare, wrapper_decl, wrapper_body, @()),
span: span
};

View File

@ -32,7 +32,7 @@ pub fn check_crate(tcx: ty::ctxt, crate: @crate) {
expr_loop(ref b, _) => {
(v.visit_block)((*b), {in_loop: true,.. cx}, v);
}
expr_fn(_, _, _) => {
expr_fn(*) => {
visit::visit_expr(e, {in_loop: false, can_ret: true}, v);
}
expr_fn_block(_, ref b) => {

View File

@ -48,7 +48,7 @@ fn collect_freevars(def_map: resolve::DefMap, blk: ast::blk)
let walk_expr = fn@(expr: @ast::expr, &&depth: int, v: visit::vt<int>) {
match expr.node {
ast::expr_fn(proto, _, _) => {
ast::expr_fn(proto, _, _, _) => {
if proto != ast::ProtoBare {
visit::visit_expr(expr, depth + 1, v);
}

View File

@ -559,8 +559,8 @@ fn visit_expr(expr: @expr, &&self: @IrMaps, vt: vt<@IrMaps>) {
}
visit::visit_expr(expr, self, vt);
}
expr_fn(_, _, _) |
expr_fn_block(_, _) => {
expr_fn(*) |
expr_fn_block(*) => {
// Interesting control flow (for loops can contain labeled
// breaks or continues)
self.add_live_node_for_node(expr.id, ExprNode(expr.span));
@ -1105,7 +1105,7 @@ impl Liveness {
self.propagate_through_expr(e, succ)
}
expr_fn(_, _, ref blk) | expr_fn_block(_, ref blk) => {
expr_fn(_, _, ref blk, _) | expr_fn_block(_, ref blk) => {
debug!("%s is an expr_fn or expr_fn_block",
expr_to_str(expr, self.tcx.sess.intr()));

View File

@ -615,7 +615,7 @@ impl VisitContext {
self.use_expr(base, comp_mode, visitor);
}
expr_fn(_, _, ref body) |
expr_fn(_, _, ref body, _) |
expr_fn_block(_, ref body) => {
let cap_vars = self.compute_captures(expr.id);
self.move_maps.capture_map.insert(expr.id, cap_vars);

View File

@ -4820,7 +4820,7 @@ pub impl Resolver {
visit_expr(expr, (), visitor);
}
expr_fn(_, ref fn_decl, ref block) |
expr_fn(_, ref fn_decl, ref block, _) |
expr_fn_block(ref fn_decl, ref block) => {
self.resolve_function(FunctionRibKind(expr.id, block.node.id),
Some(@/*bad*/copy *fn_decl),

View File

@ -789,7 +789,7 @@ pub fn create_function(fcx: fn_ctxt) -> @metadata<subprogram_md> {
}
ast_map::node_expr(expr) => {
match /*bad*/copy expr.node {
ast::expr_fn(_, decl, _) => {
ast::expr_fn(_, decl, _, _) => {
((dbg_cx.names)(~"fn"), decl.output, expr.id)
}
ast::expr_fn_block(decl, _) => {

View File

@ -566,7 +566,7 @@ fn trans_rvalue_dps_unadjusted(bcx: block, expr: @ast::expr,
return tvec::trans_fixed_vstore(bcx, expr, expr, dest);
}
// XXX: Bad copy.
ast::expr_fn(proto, copy decl, ref body) => {
ast::expr_fn(proto, copy decl, ref body, _) => {
// Don't use this function for anything real. Use the one in
// astconv instead.
return closure::trans_expr_fn(bcx, proto, decl,

View File

@ -2164,7 +2164,7 @@ pub fn check_expr_with_unifier(fcx: @fn_ctxt,
ast::expr_match(discrim, ref arms) => {
bot = _match::check_match(fcx, expr, discrim, (/*bad*/copy *arms));
}
ast::expr_fn(proto, ref decl, ref body) => {
ast::expr_fn(proto, ref decl, ref body, _) => {
check_expr_fn(fcx, expr, Some(proto),
decl, (*body), Vanilla, expected);
}

View File

@ -695,7 +695,10 @@ pub enum expr_ {
(implicit) condition is always true. */
expr_loop(blk, Option<ident>),
expr_match(@expr, ~[arm]),
expr_fn(Proto, fn_decl, blk),
// FIXME(#4717) the @() is req'd on windows or else LLVM croaks
expr_fn(Proto, fn_decl, blk, @()),
expr_fn_block(fn_decl, blk),
// Inner expr is always an expr_fn_block. We need the wrapping node to
// easily type this (a function returning nil on the inside but bool on

View File

@ -466,10 +466,11 @@ pub fn noop_fold_expr(e: expr_, fld: ast_fold) -> expr_ {
expr_match(fld.fold_expr(expr),
vec::map((*arms), |x| fld.fold_arm(*x)))
}
expr_fn(proto, decl, ref body) => {
expr_fn(proto, decl, ref body, _) => {
expr_fn(proto,
fold_fn_decl(decl, fld),
fld.fold_block(*body))
fld.fold_block(*body),
@())
}
expr_fn_block(decl, ref body) => {
expr_fn_block(fold_fn_decl(decl, fld),

View File

@ -1567,7 +1567,8 @@ pub impl Parser {
let decl = self.parse_fn_decl(|p| p.parse_arg_or_capture_item());
let body = self.parse_block();
return self.mk_expr(lo, body.span.hi,expr_fn(proto, decl, body));
return self.mk_expr(lo, body.span.hi,
expr_fn(proto, decl, body, @()));
}
// `|args| { ... }` like in `do` expressions

View File

@ -1305,7 +1305,7 @@ pub fn print_expr(s: ps, &&expr: @ast::expr) {
}
bclose_(s, expr.span, match_indent_unit);
}
ast::expr_fn(proto, decl, ref body) => {
ast::expr_fn(proto, decl, ref body, _) => {
// containing cbox, will be closed by print-block at }
cbox(s, indent_unit);
// head-box, will be closed by print-block at start

View File

@ -457,7 +457,7 @@ pub fn visit_expr<E>(ex: @expr, e: E, v: vt<E>) {
(v.visit_expr)(x, e, v);
for (*arms).each |a| { (v.visit_arm)(*a, e, v); }
}
expr_fn(proto, decl, ref body) => {
expr_fn(proto, decl, ref body, _) => {
(v.visit_fn)(fk_anon(proto), decl, (*body),
ex.span, ex.id, e, v);
}