Skip to content

Commit b0d46ef

Browse files
committed
Stop dropping object field mutability on the floor
1 parent 0ddade3 commit b0d46ef

File tree

2 files changed

+6
-12
lines changed

2 files changed

+6
-12
lines changed

src/comp/front/ast.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -407,7 +407,7 @@ type _fn = rec(fn_decl decl,
407407
type method_ = rec(ident ident, _fn meth, def_id id, ann ann);
408408
type method = spanned[method_];
409409

410-
type obj_field = rec(@ty ty, ident ident, def_id id, ann ann);
410+
type obj_field = rec(mutability mut, @ty ty, ident ident, def_id id, ann ann);
411411
type _obj = rec(vec[obj_field] fields,
412412
vec[@method] methods,
413413
option::t[@method] dtor);

src/comp/front/parser.rs

Lines changed: 5 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -855,15 +855,9 @@ fn parse_bottom_expr(&parser p) -> @ast::expr {
855855
// Only make people type () if they're actually adding new fields
856856
let option::t[vec[ast::obj_field]] fields = none;
857857
if (p.peek() == token::LPAREN) {
858-
auto pf = parse_obj_field;
859-
expect(p, token::LPAREN);
860-
861-
862-
fields = some[vec[ast::obj_field]]
863-
(parse_seq_to_end[ast::obj_field]
864-
(token::RPAREN,
865-
some(token::COMMA),
866-
pf, p));
858+
p.bump();
859+
fields = some(parse_seq_to_end(token::RPAREN, some(token::COMMA),
860+
parse_obj_field, p));
867861
}
868862

869863
let vec[@ast::method] meths = [];
@@ -1815,10 +1809,10 @@ fn parse_item_fn_or_iter(&parser p, ast::purity purity, ast::proto proto)
18151809

18161810

18171811
fn parse_obj_field(&parser p) -> ast::obj_field {
1818-
auto mut = parse_mutability(p); // TODO: store this, use it in typeck
1812+
auto mut = parse_mutability(p);
18191813
auto ty = parse_ty(p);
18201814
auto ident = parse_value_ident(p);
1821-
ret rec(ty=ty, ident=ident, id=p.next_def_id(), ann=p.get_ann());
1815+
ret rec(mut=mut, ty=ty, ident=ident, id=p.next_def_id(), ann=p.get_ann());
18221816
}
18231817

18241818
fn parse_method(&parser p) -> @ast::method {

0 commit comments

Comments
 (0)