libsyntax: Stop parsing mutable fields
This commit is contained in:
parent
481d4ca43f
commit
4e3d4b36dc
@ -118,11 +118,7 @@ pub fn classify(e: @expr,
|
|||||||
|
|
||||||
ast::expr_struct(_, ref fs, None) => {
|
ast::expr_struct(_, ref fs, None) => {
|
||||||
let cs = do vec::map((*fs)) |f| {
|
let cs = do vec::map((*fs)) |f| {
|
||||||
if f.node.mutbl == ast::m_imm {
|
|
||||||
classify(f.node.expr, tcx)
|
classify(f.node.expr, tcx)
|
||||||
} else {
|
|
||||||
non_const
|
|
||||||
}
|
|
||||||
};
|
};
|
||||||
join_all(cs)
|
join_all(cs)
|
||||||
}
|
}
|
||||||
|
@ -425,7 +425,6 @@ pub struct arm {
|
|||||||
|
|
||||||
#[deriving(Eq, Encodable, Decodable)]
|
#[deriving(Eq, Encodable, Decodable)]
|
||||||
pub struct field_ {
|
pub struct field_ {
|
||||||
mutbl: mutability,
|
|
||||||
ident: ident,
|
ident: ident,
|
||||||
expr: @expr,
|
expr: @expr,
|
||||||
}
|
}
|
||||||
|
@ -486,7 +486,7 @@ fn expr_blk(&self, b: ast::blk) -> @ast::expr {
|
|||||||
self.expr(b.span, ast::expr_block(b))
|
self.expr(b.span, ast::expr_block(b))
|
||||||
}
|
}
|
||||||
fn field_imm(&self, span: span, name: ident, e: @ast::expr) -> ast::field {
|
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 {
|
fn expr_struct(&self, span: span, path: @ast::Path, fields: ~[ast::field]) -> @ast::expr {
|
||||||
self.expr(span, ast::expr_struct(path, fields, None))
|
self.expr(span, ast::expr_struct(path, fields, None))
|
||||||
|
@ -433,7 +433,6 @@ pub fn noop_fold_expr(e: &expr_, fld: @ast_fold) -> expr_ {
|
|||||||
fn fold_field_(field: field, fld: @ast_fold) -> field {
|
fn fold_field_(field: field, fld: @ast_fold) -> field {
|
||||||
spanned {
|
spanned {
|
||||||
node: ast::field_ {
|
node: ast::field_ {
|
||||||
mutbl: field.node.mutbl,
|
|
||||||
ident: fld.fold_ident(field.node.ident),
|
ident: fld.fold_ident(field.node.ident),
|
||||||
expr: fld.fold_expr(field.node.expr),
|
expr: fld.fold_expr(field.node.expr),
|
||||||
},
|
},
|
||||||
|
@ -1157,11 +1157,13 @@ fn parse_mutability(&self) -> mutability {
|
|||||||
// parse ident COLON expr
|
// parse ident COLON expr
|
||||||
fn parse_field(&self) -> field {
|
fn parse_field(&self) -> field {
|
||||||
let lo = self.span.lo;
|
let lo = self.span.lo;
|
||||||
let m = self.parse_mutability();
|
|
||||||
let i = self.parse_ident();
|
let i = self.parse_ident();
|
||||||
self.expect(&token::COLON);
|
self.expect(&token::COLON);
|
||||||
let e = self.parse_expr();
|
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 {
|
fn mk_expr(&self, lo: BytePos, hi: BytePos, node: expr_) -> @expr {
|
||||||
@ -2566,10 +2568,6 @@ fn parse_name_and_ty(&self,
|
|||||||
pr: visibility,
|
pr: visibility,
|
||||||
attrs: ~[attribute]) -> @struct_field {
|
attrs: ~[attribute]) -> @struct_field {
|
||||||
let lo = self.span.lo;
|
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) {
|
if !is_plain_ident(&*self.token) {
|
||||||
self.fatal("expected ident");
|
self.fatal("expected ident");
|
||||||
}
|
}
|
||||||
|
@ -1083,7 +1083,6 @@ pub fn print_call_post(s: @ps,
|
|||||||
pub fn print_expr(s: @ps, expr: @ast::expr) {
|
pub fn print_expr(s: @ps, expr: @ast::expr) {
|
||||||
fn print_field(s: @ps, field: ast::field) {
|
fn print_field(s: @ps, field: ast::field) {
|
||||||
ibox(s, indent_unit);
|
ibox(s, indent_unit);
|
||||||
if field.node.mutbl == ast::m_mutbl { word_nbsp(s, "mut"); }
|
|
||||||
print_ident(s, field.node.ident);
|
print_ident(s, field.node.ident);
|
||||||
word_space(s, ":");
|
word_space(s, ":");
|
||||||
print_expr(s, field.node.expr);
|
print_expr(s, field.node.expr);
|
||||||
|
Loading…
Reference in New Issue
Block a user