diff options
Diffstat (limited to 'src/comp/syntax')
| -rw-r--r-- | src/comp/syntax/ast.rs | 14 | ||||
| -rw-r--r-- | src/comp/syntax/parse/parser.rs | 5 | ||||
| -rw-r--r-- | src/comp/syntax/print/pprust.rs | 6 |
3 files changed, 15 insertions, 10 deletions
diff --git a/src/comp/syntax/ast.rs b/src/comp/syntax/ast.rs index 9fedd515620..ec63af65729 100644 --- a/src/comp/syntax/ast.rs +++ b/src/comp/syntax/ast.rs @@ -564,7 +564,7 @@ tag view_item_ { view_item_use(ident, [@meta_item], node_id); view_item_import(ident, [ident], node_id); view_item_import_glob([ident], node_id); - view_item_export(ident, node_id); + view_item_export([ident], node_id); } type obj_def_ids = {ty: node_id, ctor: node_id}; @@ -627,11 +627,11 @@ fn is_exported(i: ident, m: _mod) -> bool { let count = 0u; for vi: @ast::view_item in m.view_items { alt vi.node { - ast::view_item_export(id, _) { - if str::eq(i, id) { - // even if it's nonlocal (since it's explicit) - - ret true; + ast::view_item_export(ids, _) { + for id in ids { + if str::eq(i, id) { + ret true; + } } count += 1u; } @@ -640,7 +640,7 @@ fn is_exported(i: ident, m: _mod) -> bool { } // If there are no declared exports then // everything not imported is exported - + // even if it's nonlocal (since it's explicit) ret count == 0u && !nonlocal; } diff --git a/src/comp/syntax/parse/parser.rs b/src/comp/syntax/parse/parser.rs index 267308c1c04..e6b65444029 100644 --- a/src/comp/syntax/parse/parser.rs +++ b/src/comp/syntax/parse/parser.rs @@ -2353,8 +2353,9 @@ fn parse_import(p: &parser) -> ast::view_item_ { } fn parse_export(p: &parser) -> ast::view_item_ { - let id = parse_ident(p); - ret ast::view_item_export(id, p.get_id()); + let ids = parse_seq_to_before_end( + token::SEMI, option::some(token::COMMA), parse_ident, p); + ret ast::view_item_export(ids, p.get_id()); } fn parse_view_item(p: &parser) -> @ast::view_item { diff --git a/src/comp/syntax/print/pprust.rs b/src/comp/syntax/print/pprust.rs index 7bd89ed36d9..43ab6c5c823 100644 --- a/src/comp/syntax/print/pprust.rs +++ b/src/comp/syntax/print/pprust.rs @@ -1276,7 +1276,11 @@ fn print_view_item(s: &ps, item: &@ast::view_item) { } word(s.s, "::*"); } - ast::view_item_export(id, _) { head(s, "export"); word(s.s, id); } + ast::view_item_export(ids, _) { + head(s, "export"); + commasep(s, inconsistent, ids, + fn(s: &ps, w: &str) { word(s.s, w) }); + } } word(s.s, ";"); end(s); // end inner head-block |
