libsyntax: Stop parsing mutable fields

This commit is contained in:
Patrick Walton 2013-05-23 19:47:38 -07:00
parent 481d4ca43f
commit 4e3d4b36dc
6 changed files with 6 additions and 15 deletions

View File

@ -118,11 +118,7 @@ pub fn classify(e: @expr,
ast::expr_struct(_, ref fs, None) => {
let cs = do vec::map((*fs)) |f| {
if f.node.mutbl == ast::m_imm {
classify(f.node.expr, tcx)
} else {
non_const
}
};
join_all(cs)
}

View File

@ -425,7 +425,6 @@ pub struct arm {
#[deriving(Eq, Encodable, Decodable)]
pub struct field_ {
mutbl: mutability,
ident: ident,
expr: @expr,
}

View File

@ -486,7 +486,7 @@ fn expr_blk(&self, b: ast::blk) -> @ast::expr {
self.expr(b.span, ast::expr_block(b))
}
fn field_imm(&self, span: span, name: ident, e: @ast::expr) -> ast::field {
respan(span, ast::field_ { mutbl: ast::m_imm, ident: name, expr: e })
respan(span, ast::field_ { ident: name, expr: e })
}
fn expr_struct(&self, span: span, path: @ast::Path, fields: ~[ast::field]) -> @ast::expr {
self.expr(span, ast::expr_struct(path, fields, None))

View File

@ -433,7 +433,6 @@ pub fn noop_fold_expr(e: &expr_, fld: @ast_fold) -> expr_ {
fn fold_field_(field: field, fld: @ast_fold) -> field {
spanned {
node: ast::field_ {
mutbl: field.node.mutbl,
ident: fld.fold_ident(field.node.ident),
expr: fld.fold_expr(field.node.expr),
},

View File

@ -1157,11 +1157,13 @@ fn parse_mutability(&self) -> mutability {
// parse ident COLON expr
fn parse_field(&self) -> field {
let lo = self.span.lo;
let m = self.parse_mutability();
let i = self.parse_ident();
self.expect(&token::COLON);
let e = self.parse_expr();
spanned(lo, e.span.hi, ast::field_ { mutbl: m, ident: i, expr: e })
spanned(lo, e.span.hi, ast::field_ {
ident: i,
expr: e
})
}
fn mk_expr(&self, lo: BytePos, hi: BytePos, node: expr_) -> @expr {
@ -2566,10 +2568,6 @@ fn parse_name_and_ty(&self,
pr: visibility,
attrs: ~[attribute]) -> @struct_field {
let lo = self.span.lo;
if self.eat_keyword(keywords::Mut) {
// Do nothing, for backwards compatibility.
// XXX: Remove after snapshot.
}
if !is_plain_ident(&*self.token) {
self.fatal("expected ident");
}

View File

@ -1083,7 +1083,6 @@ pub fn print_call_post(s: @ps,
pub fn print_expr(s: @ps, expr: @ast::expr) {
fn print_field(s: @ps, field: ast::field) {
ibox(s, indent_unit);
if field.node.mutbl == ast::m_mutbl { word_nbsp(s, "mut"); }
print_ident(s, field.node.ident);
word_space(s, ":");
print_expr(s, field.node.expr);