Skip to content

Commit d8e4607

Browse files
committed
---
yaml --- r: 3184 b: refs/heads/master c: 62939e4 h: refs/heads/master v: v3
1 parent fd7c202 commit d8e4607

File tree

4 files changed

+20
-5
lines changed

4 files changed

+20
-5
lines changed

[refs]

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,2 @@
11
---
2-
refs/heads/master: 40746fa447b78a27b649db41a6bfe63f6645d5eb
2+
refs/heads/master: 62939e41b23ebcb0fb4fd1f2abefe360d313fe56

trunk/src/comp/front/eval.rs

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@ import ast::ident;
1010
import front::parser::parser;
1111
import front::parser::spanned;
1212
import front::parser::new_parser;
13+
import front::parser::parse_inner_attributes;
1314
import front::parser::parse_mod_items;
1415
import util::common;
1516
import util::common::filename;
@@ -287,16 +288,19 @@ fn eval_crate_directive(ctx cx, env e, @ast::crate_directive cdir, str prefix,
287288
auto p0 =
288289
new_parser(cx.sess, e, start_id, full_path, cx.chpos,
289290
cx.next_ann);
290-
auto m0 = parse_mod_items(p0, token::EOF, []);
291+
auto inner_attrs = parse_inner_attributes(p0);
292+
auto first_item_outer_attrs = inner_attrs._1;
293+
auto m0 = parse_mod_items(p0, token::EOF,
294+
first_item_outer_attrs);
291295
auto next_id = p0.next_def_id();
292296
// Thread defids and chpos through the parsers
293297

294298
cx.p.set_def(next_id._1);
295299
cx.chpos = p0.get_chpos();
296300
cx.next_ann = p0.next_ann_num();
297-
auto i =
298-
front::parser::mk_item(cx.p, cdir.span.lo, cdir.span.hi, id,
299-
ast::item_mod(m0), []);
301+
auto i = front::parser::mk_item(cx.p, cdir.span.lo, cdir.span.hi,
302+
id, ast::item_mod(m0),
303+
inner_attrs._0);
300304
vec::push[@ast::item](items, i);
301305
}
302306
case (ast::cdir_dir_mod(?id, ?dir_opt, ?cdirs)) {
Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
// These are attributes of the foo module
2+
#[attr1 = "val"];
3+
#[attr2 = "val"];
4+
5+
// Attributes of the following function
6+
#[attr1 = "val"]
7+
#[attr2 = "val"]
8+
fn main() { }
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
mod m = "crate-attributes-src" {
2+
mod foo;
3+
}

0 commit comments

Comments
 (0)