Skip to content

Commit 31116dc

Browse files
committed
rustc: Make room in item_mod for metadata
Issue #487
1 parent f42977d commit 31116dc

File tree

13 files changed

+24
-24
lines changed

13 files changed

+24
-24
lines changed

src/comp/front/ast.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -452,7 +452,7 @@ type item = spanned[item_];
452452
tag item_ {
453453
item_const(ident, @ty, @expr, def_id, ann);
454454
item_fn(ident, _fn, vec[ty_param], def_id, ann);
455-
item_mod(ident, _mod, def_id);
455+
item_mod(ident, _mod, vec[meta_item], def_id);
456456
item_native_mod(ident, native_mod, def_id);
457457
item_ty(ident, @ty, vec[ty_param], def_id, ann);
458458
item_tag(ident, vec[variant], vec[ty_param], def_id, ann);
@@ -463,7 +463,7 @@ fn item_ident(@item it) -> ident {
463463
ret alt (it.node) {
464464
case (item_const(?ident, _, _, _, _)) { ident }
465465
case (item_fn(?ident, _, _, _, _)) { ident }
466-
case (item_mod(?ident, _, _)) { ident }
466+
case (item_mod(?ident, _, _, _)) { ident }
467467
case (item_native_mod(?ident, _, _)) { ident }
468468
case (item_ty(?ident, _, _, _, _)) { ident }
469469
case (item_tag(?ident, _, _, _, _)) { ident }

src/comp/front/eval.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -381,7 +381,7 @@ fn eval_crate_directive(ctx cx,
381381
cx.p.set_def(next_id._1);
382382
cx.chpos = p0.get_chpos();
383383
cx.next_ann = p0.next_ann_num();
384-
auto im = ast::item_mod(id, m0, next_id);
384+
auto im = ast::item_mod(id, m0, [], next_id);
385385
auto i = @spanned(cdir.span.lo, cdir.span.hi, im);
386386
vec::push[@ast::item](items, i);
387387
}
@@ -398,7 +398,7 @@ fn eval_crate_directive(ctx cx,
398398

399399
auto full_path = prefix + std::fs::path_sep() + path;
400400
auto m0 = eval_crate_directives_to_mod(cx, e, cdirs, full_path);
401-
auto im = ast::item_mod(id, m0, cx.p.next_def_id());
401+
auto im = ast::item_mod(id, m0, [], cx.p.next_def_id());
402402
auto i = @spanned(cdir.span.lo, cdir.span.hi, im);
403403
vec::push[@ast::item](items, i);
404404
}

src/comp/front/parser.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1918,7 +1918,7 @@ fn parse_item_mod(&parser p) -> @ast::item {
19181918
auto m = parse_mod_items(p, token::RBRACE);
19191919
auto hi = p.get_hi_pos();
19201920
expect(p, token::RBRACE);
1921-
auto item = ast::item_mod(id, m, p.next_def_id());
1921+
auto item = ast::item_mod(id, m, [], p.next_def_id());
19221922
ret @spanned(lo, hi, item);
19231923
}
19241924

src/comp/middle/metadata.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -402,7 +402,7 @@ fn encode_module_item_paths(&ebml::writer ebml_w,
402402
encode_def_id(ebml_w, did);
403403
ebml::end_tag(ebml_w);
404404
}
405-
case (ast::item_mod(?id, ?_mod, ?did)) {
405+
case (ast::item_mod(?id, ?_mod, _, ?did)) {
406406
add_to_index(ebml_w, path, index, id);
407407
ebml::start_tag(ebml_w, tag_paths_data_mod);
408408
encode_name(ebml_w, id);
@@ -560,7 +560,7 @@ fn encode_info_for_item(@trans::crate_ctxt cx, &ebml::writer ebml_w,
560560
encode_symbol(cx, ebml_w, did);
561561
ebml::end_tag(ebml_w);
562562
}
563-
case (ast::item_mod(_, _, ?did)) {
563+
case (ast::item_mod(_, _, _, ?did)) {
564564
ebml::start_tag(ebml_w, tag_items_data_item);
565565
encode_def_id(ebml_w, did);
566566
encode_kind(ebml_w, 'm' as u8);

src/comp/middle/resolve.rs

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -158,7 +158,7 @@ fn map_crate(&@env e, &@ast::crate c) {
158158
fn index_i(@env e, &@ast::item i, &scopes sc, &vt[scopes] v) {
159159
visit_item_with_scope(i, sc, v);
160160
alt (i.node) {
161-
case (ast::item_mod(_, ?md, ?defid)) {
161+
case (ast::item_mod(_, ?md, _, ?defid)) {
162162
e.mod_map.insert(defid._1,
163163
@rec(m=some(md), index=index_mod(md),
164164
mutable glob_imports=vec::empty[def](),
@@ -207,7 +207,7 @@ fn map_crate(&@env e, &@ast::crate c) {
207207
alt (sc) {
208208
case (cons(scope_item(?i), ?tl)) {
209209
alt(i.node) {
210-
case (ast::item_mod(_, _, ?defid)) {
210+
case (ast::item_mod(_, _, _, ?defid)) {
211211
ret e.mod_map.get(defid._1);
212212
}
213213
case (ast::item_native_mod(_, _, ?defid)) {
@@ -520,7 +520,7 @@ fn lookup_in_scope(&env e, scopes sc, &span sp, &ident id, namespace ns)
520520
ret lookup_in_ty_params(id, ty_params);
521521
}
522522
}
523-
case (ast::item_mod(_, _, ?defid)) {
523+
case (ast::item_mod(_, _, _, ?defid)) {
524524
ret lookup_in_local_mod(e, defid, sp, id, ns, inside);
525525
}
526526
case (ast::item_native_mod(_, ?m, ?defid)) {
@@ -711,7 +711,7 @@ fn found_def_item(&@ast::item i, namespace ns) -> option::t[def] {
711711
case (ast::item_fn(_, _, _, ?defid, _)) {
712712
if (ns == ns_value) { ret some(ast::def_fn(defid)); }
713713
}
714-
case (ast::item_mod(_, _, ?defid)) {
714+
case (ast::item_mod(_, _, _, ?defid)) {
715715
if (ns == ns_module) { ret some(ast::def_mod(defid)); }
716716
}
717717
case (ast::item_native_mod(_, _, ?defid)) {
@@ -976,7 +976,7 @@ fn index_mod(&ast::_mod md) -> mod_index {
976976
case (ast::item_fn(?id, _, _, _, _)) {
977977
add_to_index(index, id, mie_item(it));
978978
}
979-
case (ast::item_mod(?id, _, _)) {
979+
case (ast::item_mod(?id, _, _, _)) {
980980
add_to_index(index, id, mie_item(it));
981981
}
982982
case (ast::item_native_mod(?id, _, _)) {
@@ -1189,7 +1189,7 @@ fn check_block(@env e, &ast::block b, &() x, &vt[()] v) {
11891189
case (ast::item_fn(?name, _, _, _, _)) {
11901190
add_name(values, it.span, name);
11911191
}
1192-
case (ast::item_mod(?name, _, _)) {
1192+
case (ast::item_mod(?name, _, _, _)) {
11931193
add_name(mods, it.span, name);
11941194
}
11951195
case (ast::item_native_mod(?name, _, _)) {

src/comp/middle/trans.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -8165,7 +8165,7 @@ fn trans_item(@local_ctxt cx, &ast::item item) {
81658165
*extend_path(cx, name));
81668166
trans_obj(sub_cx, item.span, ob, oid.ctor, tps, ann);
81678167
}
8168-
case (ast::item_mod(?name, ?m, _)) {
8168+
case (ast::item_mod(?name, ?m, _, _)) {
81698169
auto sub_cx = @rec(path = cx.path + [name],
81708170
module_path = cx.module_path + [name]
81718171
with *cx);
@@ -8488,7 +8488,7 @@ fn item_path(&@ast::item item) -> vec[str] {
84888488
alt (item.node) {
84898489
case (ast::item_fn(?name, _, _, _, _)) { ret [name]; }
84908490
case (ast::item_obj(?name, _, _, _, _)) { ret [name]; }
8491-
case (ast::item_mod(?name, _, _)) { ret [name]; }
8491+
case (ast::item_mod(?name, _, _, _)) { ret [name]; }
84928492
case (_) { ret []; }
84938493
}
84948494
}
@@ -8521,7 +8521,7 @@ fn collect_item_1(@crate_ctxt ccx, &@ast::item i,
85218521
ccx.items.insert(cid, i);
85228522
ccx.consts.insert(cid, g);
85238523
}
8524-
case (ast::item_mod(?name, ?m, ?mid)) {
8524+
case (ast::item_mod(?name, ?m, _, ?mid)) {
85258525
ccx.items.insert(mid, i);
85268526
}
85278527
case (ast::item_native_mod(_, _, ?mid)) {

src/comp/middle/tstate/pre_post_conditions.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -118,7 +118,7 @@ fn find_pre_post_item(&crate_ctxt ccx, &item i) -> () {
118118
id=di, name=id, ccx=ccx);
119119
find_pre_post_fn(fcx, f);
120120
}
121-
case (item_mod(?id, ?m, ?di)) {
121+
case (item_mod(?id, ?m, _, ?di)) {
122122
find_pre_post_mod(m);
123123
}
124124
case (item_native_mod(?id, ?nm, ?di)) {

src/comp/middle/ty.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1629,7 +1629,7 @@ fn item_ann(&@ast::item it) -> ast::ann {
16291629
alt (it.node) {
16301630
case (ast::item_const(_,_,_,_,?a)) { ret a; }
16311631
case (ast::item_fn(_,_,_,_,?a)) { ret a; }
1632-
case (ast::item_mod(_,_,_)) {
1632+
case (ast::item_mod(_,_,_, _)) {
16331633
log_err "a module was passed to item_ann(), " +
16341634
"but modules haven't annotations";
16351635
fail;

src/comp/middle/typeck.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -647,7 +647,7 @@ mod collect {
647647
ret tpt;
648648
}
649649

650-
case (ast::item_mod(_, _, _)) { fail; }
650+
case (ast::item_mod(_, _, _, _)) { fail; }
651651
case (ast::item_native_mod(_, _, _)) { fail; }
652652
}
653653
}
@@ -756,7 +756,7 @@ mod collect {
756756
fn convert(@ctxt cx, @mutable option::t[ast::native_abi] abi,
757757
&@ast::item it) {
758758
alt (it.node) {
759-
case (ast::item_mod(_, _, _)) {
759+
case (ast::item_mod(_, _, _, _)) {
760760
// ignore item_mod, it has no type.
761761
}
762762
case (ast::item_native_mod(_, ?native_mod, _)) {

src/comp/middle/visit.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -111,7 +111,7 @@ fn visit_item[E](&@item i, &E e, &vt[E] v) {
111111
case (item_fn(?nm, ?f, ?tp, ?d, ?a)) {
112112
vt(v).visit_fn(f, tp, i.span, nm, d, a, e, v);
113113
}
114-
case (item_mod(_, ?m, _)) {
114+
case (item_mod(_, ?m, _, _)) {
115115
vt(v).visit_mod(m, i.span, e, v);
116116
}
117117
case (item_native_mod(_, ?nm, _)) {

src/comp/middle/walk.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -121,7 +121,7 @@ fn walk_item(&ast_visitor v, @ast::item i) {
121121
case (ast::item_fn(?nm, ?f, _, ?d, ?a)) {
122122
walk_fn(v, f, i.span, nm, d, a);
123123
}
124-
case (ast::item_mod(_, ?m, _)) {
124+
case (ast::item_mod(_, ?m, _, _)) {
125125
walk_mod(v, m);
126126
}
127127
case (ast::item_native_mod(_, ?nm, _)) {

src/comp/pretty/pprust.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -273,7 +273,7 @@ fn print_item(&ps s, &@ast::item item) {
273273
word(s.s, " ");
274274
print_block(s, _fn.body);
275275
}
276-
case (ast::item_mod(?id,?_mod,_)) {
276+
case (ast::item_mod(?id,?_mod,_,_)) {
277277
head(s, "mod");
278278
word_nbsp(s, id);
279279
bopen(s);

src/comp/util/common.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -187,7 +187,7 @@ fn decl_lhs(@ast::decl d) -> ast::def_id {
187187
case (ast::item_fn(_,_,_,?d,_)) {
188188
ret d;
189189
}
190-
case (ast::item_mod(_,_,?d)) {
190+
case (ast::item_mod(_,_,_,?d)) {
191191
ret d;
192192
}
193193
case (ast::item_native_mod(_,_,?d)) {

0 commit comments

Comments
 (0)