Implement import renaming with _ (RFC 2166)

This commit is contained in:
Vadim Petrochenkov 2018-03-11 00:18:05 +03:00
parent fab632f975
commit 12ac032c72
6 changed files with 153 additions and 1 deletions

View file

@ -7040,7 +7040,11 @@ impl<'a> Parser<'a> {
fn parse_rename(&mut self) -> PResult<'a, Option<Ident>> {
if self.eat_keyword(keywords::As) {
self.parse_ident().map(Some)
if self.eat(&token::Underscore) {
Ok(Some(Ident::with_empty_ctxt(Symbol::gensym("_"))))
} else {
self.parse_ident().map(Some)
}
} else {
Ok(None)
}