Add span to field to catch per-field comments in rec exprs.

This commit is contained in:
Graydon Hoare 2011-05-30 15:56:01 -07:00
parent d12ea39896
commit b48cab962a
8 changed files with 27 additions and 22 deletions

View file

@ -5423,9 +5423,9 @@ fn trans_rec(&@block_ctxt cx, &vec[ast::field] fields,
auto src_res = res(bcx, C_nil());
for (ast::field f in fields) {
if (str::eq(f.ident, tf.ident)) {
if (str::eq(f.node.ident, tf.ident)) {
expr_provided = true;
src_res = trans_expr(bcx, f.expr);
src_res = trans_expr(bcx, f.node.expr);
}
}
if (!expr_provided) {

View file

@ -1248,11 +1248,11 @@ mod pushdown {
case (none) {
auto i = 0u;
for (ast::field field_0 in fields_0) {
assert (str::eq(field_0.ident,
assert (str::eq(field_0.node.ident,
field_mts.(i).ident));
pushdown_expr(scx,
field_mts.(i).mt.ty,
field_0.expr);
field_0.node.expr);
i += 1u;
}
}
@ -1263,10 +1263,10 @@ mod pushdown {
for (ast::field field_0 in fields_0) {
for (ty::field ft in field_mts) {
if (str::eq(field_0.ident,
if (str::eq(field_0.node.ident,
ft.ident)) {
pushdown_expr(scx, ft.mt.ty,
field_0.expr);
field_0.node.expr);
}
}
}
@ -2461,11 +2461,12 @@ fn check_expr(&@stmt_ctxt scx, &@ast::expr expr) {
let vec[field] fields_t = [];
for (ast::field f in fields) {
check_expr(scx, f.expr);
auto expr_t = expr_ty(scx.fcx.ccx.tcx, f.expr);
check_expr(scx, f.node.expr);
auto expr_t = expr_ty(scx.fcx.ccx.tcx, f.node.expr);
auto expr_mt = rec(ty=expr_t, mut=f.mut);
vec::push[field](fields_t, rec(ident=f.ident, mt=expr_mt));
auto expr_mt = rec(ty=expr_t, mut=f.node.mut);
vec::push[field](fields_t, rec(ident=f.node.ident,
mt=expr_mt));
}
alt (base) {

View file

@ -323,7 +323,7 @@ fn walk_expr(&ast_visitor v, @ast::expr e) {
}
case (ast::expr_rec(?flds, ?base, _)) {
for (ast::field f in flds) {
walk_expr(v, f.expr);
walk_expr(v, f.node.expr);
}
walk_expr_opt(v, base);
}