1
Fork 0

auto merge of #16468 : pcwalton/rust/as-renaming-import, r=alexcrichton

The old syntax will be removed after a snapshot.

RFC #47.

Issue #16461.

r? @brson
This commit is contained in:
bors 2014-08-14 21:01:19 +00:00
commit f8e0ede921
29 changed files with 51 additions and 43 deletions

View file

@ -5317,6 +5317,7 @@ impl<'a> Parser<'a> {
match self.token {
token::EQ => {
// x = foo::bar
// NOTE(stage0, #16461, pcwalton): Deprecate after snapshot.
self.bump();
let path_lo = self.span.lo;
path = vec!(self.parse_ident());
@ -5399,7 +5400,7 @@ impl<'a> Parser<'a> {
}
_ => ()
}
let last = *path.get(path.len() - 1u);
let mut rename_to = *path.get(path.len() - 1u);
let path = ast::Path {
span: mk_sp(lo, self.span.hi),
global: false,
@ -5411,9 +5412,12 @@ impl<'a> Parser<'a> {
}
}).collect()
};
if self.eat_keyword(keywords::As) {
rename_to = self.parse_ident()
}
return box(GC) spanned(lo,
self.last_span.hi,
ViewPathSimple(last, path, ast::DUMMY_NODE_ID));
ViewPathSimple(rename_to, path, ast::DUMMY_NODE_ID));
}
/// Parses a sequence of items. Stops when it finds program