libsyntax: Make "pub use" mean the same thing as the former "import" in all circumstances

This commit is contained in:
Patrick Walton 2012-09-05 13:26:46 -07:00
parent 10c533861b
commit e7fe903d88

View File

@ -3267,7 +3267,7 @@ fn parse_item_or_view_item(+attrs: ~[attribute], items_allowed: bool)
visibility,
maybe_append(attrs, extra_attrs)));
} else if self.eat_keyword(~"use") {
let view_item = self.parse_use();
let view_item = self.parse_use(visibility);
self.expect(token::SEMI);
return iovi_view_item(@{
node: view_item,
@ -3327,9 +3327,9 @@ fn parse_item(+attrs: ~[attribute]) -> Option<@ast::item> {
}
}
fn parse_use() -> view_item_ {
if self.look_ahead(1) == token::SEMI ||
self.look_ahead(1) == token::LPAREN {
fn parse_use(vis: visibility) -> view_item_ {
if vis != public && (self.look_ahead(1) == token::SEMI ||
self.look_ahead(1) == token::LPAREN) {
// Old-style "use"; i.e. what we now call "extern mod".
let ident = self.parse_ident();
let metadata = self.parse_optional_meta();
@ -3445,7 +3445,7 @@ fn is_view_item() -> bool {
fn parse_view_item(+attrs: ~[attribute]) -> @view_item {
let lo = self.span.lo, vis = self.parse_visibility();
let node = if self.eat_keyword(~"use") {
self.parse_use()
self.parse_use(vis)
} else if self.eat_keyword(~"import") {
view_item_import(self.parse_view_paths())
} else if self.eat_keyword(~"export") {