syntax: struct field attributes and cfg
This commit is contained in:
parent
8f62c29200
commit
7972c1905b
12 changed files with 164 additions and 19 deletions
|
@ -1946,6 +1946,7 @@ impl<'a> Parser<'a> {
|
|||
|
||||
/// Parse ident (COLON expr)?
|
||||
pub fn parse_field(&mut self) -> PResult<'a, Field> {
|
||||
let attrs = self.parse_outer_attributes()?;
|
||||
let lo = self.span.lo;
|
||||
let hi;
|
||||
|
||||
|
@ -1968,6 +1969,7 @@ impl<'a> Parser<'a> {
|
|||
span: mk_sp(lo, expr.span.hi),
|
||||
expr: expr,
|
||||
is_shorthand: is_shorthand,
|
||||
attrs: attrs.into(),
|
||||
})
|
||||
}
|
||||
|
||||
|
@ -3436,6 +3438,7 @@ impl<'a> Parser<'a> {
|
|||
if self.check(&token::CloseDelim(token::Brace)) { break }
|
||||
}
|
||||
|
||||
let attrs = self.parse_outer_attributes()?;
|
||||
let lo = self.span.lo;
|
||||
let hi;
|
||||
|
||||
|
@ -3493,9 +3496,13 @@ impl<'a> Parser<'a> {
|
|||
};
|
||||
|
||||
fields.push(codemap::Spanned { span: mk_sp(lo, hi),
|
||||
node: ast::FieldPat { ident: fieldname,
|
||||
pat: subpat,
|
||||
is_shorthand: is_shorthand }});
|
||||
node: ast::FieldPat {
|
||||
ident: fieldname,
|
||||
pat: subpat,
|
||||
is_shorthand: is_shorthand,
|
||||
attrs: attrs.into(),
|
||||
}
|
||||
});
|
||||
}
|
||||
return Ok((fields, etc));
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue