Now imports are not re-exported unless 'export' is explicitly used.

This commit is contained in:
Paul Stansifer 2011-05-31 18:24:06 -07:00
parent 8b141d5d37
commit 9f5dddf08c
21 changed files with 148 additions and 227 deletions

View file

@ -438,20 +438,40 @@ tag native_item_ {
}
fn is_exported(ident i, _mod m) -> bool {
auto count = 0;
auto nonlocal = true;
for (@ast::item it in m.items) {
if (item_ident(it) == i) {
nonlocal = false;
}
alt (it.node) {
case (item_tag(_, ?variants, _, _, _)) {
for (variant v in variants) {
if (v.node.name == i) {
nonlocal = false;
}
}
}
case (_) {}
}
}
auto count = 0u;
for (@ast::view_item vi in m.view_items) {
alt (vi.node) {
case (ast::view_item_export(?id)) {
if (str::eq(i, id)) {
// even if it's nonlocal (since it's explicit)
ret true;
}
count += 1;
count += 1u;
}
case (_) { /* fall through */ }
}
}
// If there are no declared exports then everything is exported
if (count == 0) {
// If there are no declared exports then
// everything not imported is exported
if (count == 0u && !nonlocal) {
ret true;
} else {
ret false;

View file

@ -231,7 +231,7 @@ fn expect(&parser p, token::token t) {
}
}
fn spanned[T](uint lo, uint hi, &T node) -> ast::spanned[T] {
fn spanned[T](uint lo, uint hi, &T node) -> common::spanned[T] {
ret rec(node=node, span=rec(lo=lo, hi=hi));
}
@ -1008,7 +1008,7 @@ fn parse_bottom_expr(&parser p) -> @ast::expr {
* loading rust crates to process extensions.
*/
fn expand_syntax_ext(&parser p, ast::span sp,
fn expand_syntax_ext(&parser p, common::span sp,
&ast::path path, vec[@ast::expr] args,
option::t[str] body) -> ast::expr_ {