Refactor away variant ast::PathListItemKind::Mod

and refactor `ast::PathListItemKind::Ident` -> `ast::PathListItem_`.
This commit is contained in:
Jeffrey Seyfried
2016-08-12 09:01:22 +00:00
parent 1576de0ce6
commit 98ce875b58
10 changed files with 52 additions and 108 deletions

View File

@@ -6017,13 +6017,16 @@ impl<'a> Parser<'a> {
&token::CloseDelim(token::Brace),
SeqSep::trailing_allowed(token::Comma), |this| {
let lo = this.span.lo;
let node = if this.eat_keyword(keywords::SelfValue) {
let rename = this.parse_rename()?;
ast::PathListItemKind::Mod { id: ast::DUMMY_NODE_ID, rename: rename }
let ident = if this.eat_keyword(keywords::SelfValue) {
keywords::SelfValue.ident()
} else {
let ident = this.parse_ident()?;
let rename = this.parse_rename()?;
ast::PathListItemKind::Ident { name: ident, rename: rename, id: ast::DUMMY_NODE_ID }
this.parse_ident()?
};
let rename = this.parse_rename()?;
let node = ast::PathListItem_ {
name: ident,
rename: rename,
id: ast::DUMMY_NODE_ID
};
let hi = this.last_span.hi;
Ok(spanned(lo, hi, node))