1
Fork 0

rustc: Implement functional record update for structs

This commit is contained in:
Patrick Walton 2012-08-06 13:15:40 -07:00
parent 1e3143b34e
commit bff512a90f
10 changed files with 127 additions and 46 deletions

View file

@ -478,8 +478,10 @@ fn noop_fold_expr(e: expr_, fld: ast_fold) -> expr_ {
fld.fold_expr(e)),
expr_assert(e) => expr_assert(fld.fold_expr(e)),
expr_mac(mac) => expr_mac(fold_mac(mac)),
expr_struct(path, fields) => {
expr_struct(fld.fold_path(path), vec::map(fields, fold_field))
expr_struct(path, fields, maybe_expr) => {
expr_struct(fld.fold_path(path),
vec::map(fields, fold_field),
option::map(maybe_expr, |x| fld.fold_expr(x)))
}
}
}