rustc: Parse crate attributes in standalone .rs files

Issue #487
This commit is contained in:
Brian Anderson 2011-06-16 16:09:43 -07:00
parent ffae642663
commit e83a115d79
2 changed files with 11 additions and 1 deletions

View file

@ -2285,7 +2285,11 @@ fn parse_native_view(&parser p) -> vec[@ast::view_item] {
fn parse_crate_from_source_file(&parser p) -> @ast::crate {
auto lo = p.get_lo_pos();
auto m = parse_mod_items(p, token::EOF, []);
// FIXME (issue #487): Do something with these attrs
auto crate_attrs = parse_inner_attrs_and_next(p);
auto first_item_outer_attrs = crate_attrs._1;
auto m = parse_mod_items(p, token::EOF,
first_item_outer_attrs);
let vec[@ast::crate_directive] cdirs = [];
ret @spanned(lo, p.get_lo_pos(), rec(directives=cdirs, module=m));
}

View file

@ -1,5 +1,11 @@
// xfail-stage0
// These are attributes of the implicit crate. Really this just needs to parse
// for completeness since .rs files linked from .rc files support this
// notation to specify their module's attributes
#[attr1 = "val"];
#[attr2 = "val"];
// These are are attributes of the following mod
#[attr1 = "val"]
#[attr2 = "val"]