mirror of
https://github.com/rust-lang/rust.git
synced 2025-04-28 02:57:37 +00:00
parent
697fdaac24
commit
1c9277e0d3
@ -465,24 +465,24 @@ type attribute_ = rec(attr_style style,
|
||||
|
||||
type item = spanned[item_];
|
||||
tag item_ {
|
||||
item_const(ident, @ty, @expr, def_id, ann);
|
||||
item_fn(ident, _fn, vec[ty_param], def_id, ann);
|
||||
item_const(ident, @ty, @expr, vec[attribute], def_id, ann);
|
||||
item_fn(ident, _fn, vec[ty_param], vec[attribute], def_id, ann);
|
||||
item_mod(ident, _mod, vec[attribute], def_id);
|
||||
item_native_mod(ident, native_mod, def_id);
|
||||
item_ty(ident, @ty, vec[ty_param], def_id, ann);
|
||||
item_tag(ident, vec[variant], vec[ty_param], def_id, ann);
|
||||
item_obj(ident, _obj, vec[ty_param], obj_def_ids, ann);
|
||||
item_native_mod(ident, native_mod, vec[attribute], def_id);
|
||||
item_ty(ident, @ty, vec[ty_param], vec[attribute], def_id, ann);
|
||||
item_tag(ident, vec[variant], vec[ty_param], vec[attribute], def_id, ann);
|
||||
item_obj(ident, _obj, vec[ty_param], vec[attribute], obj_def_ids, ann);
|
||||
}
|
||||
|
||||
fn item_ident(@item it) -> ident {
|
||||
ret alt (it.node) {
|
||||
case (item_const(?ident, _, _, _, _)) { ident }
|
||||
case (item_fn(?ident, _, _, _, _)) { ident }
|
||||
case (item_const(?ident, _, _, _, _, _)) { ident }
|
||||
case (item_fn(?ident, _, _, _, _, _)) { ident }
|
||||
case (item_mod(?ident, _, _, _)) { ident }
|
||||
case (item_native_mod(?ident, _, _)) { ident }
|
||||
case (item_ty(?ident, _, _, _, _)) { ident }
|
||||
case (item_tag(?ident, _, _, _, _)) { ident }
|
||||
case (item_obj(?ident, _, _, _, _)) { ident }
|
||||
case (item_native_mod(?ident, _, _, _)) { ident }
|
||||
case (item_ty(?ident, _, _, _, _, _)) { ident }
|
||||
case (item_tag(?ident, _, _, _, _, _)) { ident }
|
||||
case (item_obj(?ident, _, _, _, _, _)) { ident }
|
||||
}
|
||||
}
|
||||
|
||||
@ -500,7 +500,7 @@ fn is_exported(ident i, _mod m) -> bool {
|
||||
nonlocal = false;
|
||||
}
|
||||
alt (it.node) {
|
||||
case (item_tag(_, ?variants, _, _, _)) {
|
||||
case (item_tag(_, ?variants, _, _, _, _)) {
|
||||
for (variant v in variants) {
|
||||
if (v.node.name == i) {
|
||||
nonlocal = false;
|
||||
|
@ -1797,12 +1797,12 @@ fn parse_fn_header(&parser p)
|
||||
ret tup(id, ty_params);
|
||||
}
|
||||
|
||||
fn parse_item_fn_or_iter(&parser p, ast::purity purity, ast::proto proto)
|
||||
-> @ast::item {
|
||||
fn parse_item_fn_or_iter(&parser p, ast::purity purity, ast::proto proto,
|
||||
vec[ast::attribute] attrs ) -> @ast::item {
|
||||
auto lo = p.get_last_lo_pos();
|
||||
auto t = parse_fn_header(p);
|
||||
auto f = parse_fn(p, proto, purity);
|
||||
auto item = ast::item_fn(t._0, f, t._1,
|
||||
auto item = ast::item_fn(t._0, f, t._1, attrs,
|
||||
p.next_def_id(), p.get_ann());
|
||||
ret @spanned(lo, f.body.span.hi, item);
|
||||
}
|
||||
@ -1846,7 +1846,8 @@ fn parse_dtor(&parser p) -> @ast::method {
|
||||
ret @spanned(lo, f.body.span.hi, m);
|
||||
}
|
||||
|
||||
fn parse_item_obj(&parser p, ast::layer lyr) -> @ast::item {
|
||||
fn parse_item_obj(&parser p, ast::layer lyr,
|
||||
vec[ast::attribute] attrs) -> @ast::item {
|
||||
auto lo = p.get_last_lo_pos();
|
||||
auto ident = parse_value_ident(p);
|
||||
auto ty_params = parse_ty_params(p);
|
||||
@ -1877,7 +1878,7 @@ fn parse_item_obj(&parser p, ast::layer lyr) -> @ast::item {
|
||||
dtor=dtor);
|
||||
|
||||
auto odid = rec(ty=p.next_def_id(), ctor=p.next_def_id());
|
||||
auto item = ast::item_obj(ident, ob, ty_params, odid, p.get_ann());
|
||||
auto item = ast::item_obj(ident, ob, ty_params, attrs, odid, p.get_ann());
|
||||
|
||||
ret @spanned(lo, hi, item);
|
||||
}
|
||||
@ -1900,7 +1901,7 @@ fn parse_mod_items(&parser p, token::token term) -> ast::_mod {
|
||||
ret rec(view_items=view_items, items=items);
|
||||
}
|
||||
|
||||
fn parse_item_const(&parser p) -> @ast::item {
|
||||
fn parse_item_const(&parser p, vec[ast::attribute] attrs) -> @ast::item {
|
||||
auto lo = p.get_last_lo_pos();
|
||||
auto ty = parse_ty(p);
|
||||
auto id = parse_value_ident(p);
|
||||
@ -1908,7 +1909,8 @@ fn parse_item_const(&parser p) -> @ast::item {
|
||||
auto e = parse_expr(p);
|
||||
auto hi = p.get_hi_pos();
|
||||
expect(p, token::SEMI);
|
||||
auto item = ast::item_const(id, ty, e, p.next_def_id(), p.get_ann());
|
||||
auto item = ast::item_const(id, ty, e, attrs,
|
||||
p.next_def_id(), p.get_ann());
|
||||
ret @spanned(lo, hi, item);
|
||||
}
|
||||
|
||||
@ -1994,7 +1996,7 @@ fn default_native_name(session::session sess, str id) -> str {
|
||||
ret n.prefix + id + n.suffix;
|
||||
}
|
||||
|
||||
fn parse_item_native_mod(&parser p) -> @ast::item {
|
||||
fn parse_item_native_mod(&parser p, vec[ast::attribute] attrs) -> @ast::item {
|
||||
auto lo = p.get_last_lo_pos();
|
||||
auto abi = ast::native_abi_cdecl;
|
||||
if (!is_word(p, "mod")) {
|
||||
@ -2024,7 +2026,7 @@ fn parse_item_native_mod(&parser p) -> @ast::item {
|
||||
auto m = parse_native_mod_items(p, native_name, abi);
|
||||
auto hi = p.get_hi_pos();
|
||||
expect(p, token::RBRACE);
|
||||
auto item = ast::item_native_mod(id, m, p.next_def_id());
|
||||
auto item = ast::item_native_mod(id, m, attrs, p.next_def_id());
|
||||
ret @spanned(lo, hi, item);
|
||||
}
|
||||
|
||||
@ -2034,7 +2036,7 @@ fn parse_type_decl(&parser p) -> tup(uint, ast::ident) {
|
||||
ret tup(lo, id);
|
||||
}
|
||||
|
||||
fn parse_item_type(&parser p) -> @ast::item {
|
||||
fn parse_item_type(&parser p, vec[ast::attribute] attrs) -> @ast::item {
|
||||
auto t = parse_type_decl(p);
|
||||
auto tps = parse_ty_params(p);
|
||||
|
||||
@ -2042,11 +2044,12 @@ fn parse_item_type(&parser p) -> @ast::item {
|
||||
auto ty = parse_ty(p);
|
||||
auto hi = p.get_hi_pos();
|
||||
expect(p, token::SEMI);
|
||||
auto item = ast::item_ty(t._1, ty, tps, p.next_def_id(), p.get_ann());
|
||||
auto item = ast::item_ty(t._1, ty, tps, attrs,
|
||||
p.next_def_id(), p.get_ann());
|
||||
ret @spanned(t._0, hi, item);
|
||||
}
|
||||
|
||||
fn parse_item_tag(&parser p) -> @ast::item {
|
||||
fn parse_item_tag(&parser p, vec[ast::attribute] attrs) -> @ast::item {
|
||||
auto lo = p.get_last_lo_pos();
|
||||
auto id = parse_ident(p);
|
||||
auto ty_params = parse_ty_params(p);
|
||||
@ -2092,8 +2095,8 @@ fn parse_item_tag(&parser p) -> @ast::item {
|
||||
auto hi = p.get_hi_pos();
|
||||
p.bump();
|
||||
|
||||
auto item = ast::item_tag(id, variants, ty_params, p.next_def_id(),
|
||||
p.get_ann());
|
||||
auto item = ast::item_tag(id, variants, ty_params, attrs,
|
||||
p.next_def_id(), p.get_ann());
|
||||
ret @spanned(lo, hi, item);
|
||||
}
|
||||
|
||||
@ -2128,29 +2131,31 @@ tag parsed_item {
|
||||
fn parse_item(&parser p, vec[ast::attribute] attrs) -> parsed_item {
|
||||
|
||||
if (eat_word(p, "const")) {
|
||||
ret got_item(parse_item_const(p));
|
||||
ret got_item(parse_item_const(p, attrs));
|
||||
} else if (eat_word(p, "fn")) {
|
||||
// This is an anonymous function
|
||||
if (p.peek() == token::LPAREN) { ret fn_no_item; }
|
||||
ret got_item(parse_item_fn_or_iter(p, ast::impure_fn, ast::proto_fn));
|
||||
ret got_item(parse_item_fn_or_iter(p, ast::impure_fn,
|
||||
ast::proto_fn, attrs));
|
||||
} else if (eat_word(p, "pred")) {
|
||||
ret got_item(parse_item_fn_or_iter(p, ast::pure_fn, ast::proto_fn));
|
||||
ret got_item(parse_item_fn_or_iter(p, ast::pure_fn,
|
||||
ast::proto_fn, attrs));
|
||||
} else if (eat_word(p, "iter")) {
|
||||
ret got_item(parse_item_fn_or_iter(p, ast::impure_fn,
|
||||
ast::proto_iter));
|
||||
ast::proto_iter, attrs));
|
||||
} else if (eat_word(p, "mod")) {
|
||||
ret got_item(parse_item_mod(p, attrs));
|
||||
} else if (eat_word(p, "native")) {
|
||||
ret got_item(parse_item_native_mod(p));
|
||||
ret got_item(parse_item_native_mod(p, attrs));
|
||||
}
|
||||
|
||||
auto lyr = parse_layer(p);
|
||||
if (eat_word(p, "type")) {
|
||||
ret got_item(parse_item_type(p));
|
||||
ret got_item(parse_item_type(p, attrs));
|
||||
} else if (eat_word(p, "tag")) {
|
||||
ret got_item(parse_item_tag(p));
|
||||
ret got_item(parse_item_tag(p, attrs));
|
||||
} else if (eat_word(p, "obj")) {
|
||||
ret got_item(parse_item_obj(p, lyr));
|
||||
ret got_item(parse_item_obj(p, lyr, attrs));
|
||||
} else {
|
||||
ret no_item;
|
||||
}
|
||||
|
@ -66,7 +66,7 @@ fn visit_fn(@ctx cx, &ast::_fn f, &vec[ast::ty_param] tp, &span sp,
|
||||
|
||||
fn visit_item(@ctx cx, &@ast::item i, &scope sc, &vt[scope] v) {
|
||||
alt (i.node) {
|
||||
case (ast::item_obj(_, ?o, _, _, _)) {
|
||||
case (ast::item_obj(_, ?o, _, _, _, _)) {
|
||||
for (ast::obj_field f in o.fields) {
|
||||
cx.local_map.insert(f.id._1, objfield(f.mut));
|
||||
}
|
||||
|
@ -388,14 +388,14 @@ fn encode_module_item_paths(&ebml::writer ebml_w,
|
||||
}
|
||||
|
||||
alt (it.node) {
|
||||
case (ast::item_const(?id, _, ?tps, ?did, ?ann)) {
|
||||
case (ast::item_const(?id, _, ?tps, _, ?did, ?ann)) {
|
||||
add_to_index(ebml_w, path, index, id);
|
||||
ebml::start_tag(ebml_w, tag_paths_data_item);
|
||||
encode_name(ebml_w, id);
|
||||
encode_def_id(ebml_w, did);
|
||||
ebml::end_tag(ebml_w);
|
||||
}
|
||||
case (ast::item_fn(?id, _, ?tps, ?did, ?ann)) {
|
||||
case (ast::item_fn(?id, _, ?tps, _, ?did, ?ann)) {
|
||||
add_to_index(ebml_w, path, index, id);
|
||||
ebml::start_tag(ebml_w, tag_paths_data_item);
|
||||
encode_name(ebml_w, id);
|
||||
@ -410,7 +410,7 @@ fn encode_module_item_paths(&ebml::writer ebml_w,
|
||||
encode_module_item_paths(ebml_w, _mod, path + [id], index);
|
||||
ebml::end_tag(ebml_w);
|
||||
}
|
||||
case (ast::item_native_mod(?id, ?nmod, ?did)) {
|
||||
case (ast::item_native_mod(?id, ?nmod, _, ?did)) {
|
||||
add_to_index(ebml_w, path, index, id);
|
||||
ebml::start_tag(ebml_w, tag_paths_data_mod);
|
||||
encode_name(ebml_w, id);
|
||||
@ -419,14 +419,14 @@ fn encode_module_item_paths(&ebml::writer ebml_w,
|
||||
index);
|
||||
ebml::end_tag(ebml_w);
|
||||
}
|
||||
case (ast::item_ty(?id, _, ?tps, ?did, ?ann)) {
|
||||
case (ast::item_ty(?id, _, ?tps, _, ?did, ?ann)) {
|
||||
add_to_index(ebml_w, path, index, id);
|
||||
ebml::start_tag(ebml_w, tag_paths_data_item);
|
||||
encode_name(ebml_w, id);
|
||||
encode_def_id(ebml_w, did);
|
||||
ebml::end_tag(ebml_w);
|
||||
}
|
||||
case (ast::item_tag(?id, ?variants, ?tps, ?did, _)) {
|
||||
case (ast::item_tag(?id, ?variants, ?tps, _, ?did, _)) {
|
||||
add_to_index(ebml_w, path, index, id);
|
||||
ebml::start_tag(ebml_w, tag_paths_data_item);
|
||||
encode_name(ebml_w, id);
|
||||
@ -435,7 +435,7 @@ fn encode_module_item_paths(&ebml::writer ebml_w,
|
||||
|
||||
encode_tag_variant_paths(ebml_w, variants, path, index);
|
||||
}
|
||||
case (ast::item_obj(?id, _, ?tps, ?odid, ?ann)) {
|
||||
case (ast::item_obj(?id, _, ?tps, _, ?odid, ?ann)) {
|
||||
add_to_index(ebml_w, path, index, id);
|
||||
ebml::start_tag(ebml_w, tag_paths_data_item);
|
||||
encode_name(ebml_w, id);
|
||||
@ -543,7 +543,7 @@ fn encode_tag_variant_info(&@trans::crate_ctxt cx, &ebml::writer ebml_w,
|
||||
fn encode_info_for_item(@trans::crate_ctxt cx, &ebml::writer ebml_w,
|
||||
@ast::item item, &mutable vec[tup(int, uint)] index) {
|
||||
alt (item.node) {
|
||||
case (ast::item_const(_, _, _, ?did, ?ann)) {
|
||||
case (ast::item_const(_, _, _, _, ?did, ?ann)) {
|
||||
ebml::start_tag(ebml_w, tag_items_data_item);
|
||||
encode_def_id(ebml_w, did);
|
||||
encode_kind(ebml_w, 'c' as u8);
|
||||
@ -551,7 +551,7 @@ fn encode_info_for_item(@trans::crate_ctxt cx, &ebml::writer ebml_w,
|
||||
encode_symbol(cx, ebml_w, did);
|
||||
ebml::end_tag(ebml_w);
|
||||
}
|
||||
case (ast::item_fn(_, _, ?tps, ?did, ?ann)) {
|
||||
case (ast::item_fn(_, _, ?tps, _, ?did, ?ann)) {
|
||||
ebml::start_tag(ebml_w, tag_items_data_item);
|
||||
encode_def_id(ebml_w, did);
|
||||
encode_kind(ebml_w, 'f' as u8);
|
||||
@ -566,13 +566,13 @@ fn encode_info_for_item(@trans::crate_ctxt cx, &ebml::writer ebml_w,
|
||||
encode_kind(ebml_w, 'm' as u8);
|
||||
ebml::end_tag(ebml_w);
|
||||
}
|
||||
case (ast::item_native_mod(?id, _, ?did)) {
|
||||
case (ast::item_native_mod(?id, _, _, ?did)) {
|
||||
ebml::start_tag(ebml_w, tag_items_data_item);
|
||||
encode_def_id(ebml_w, did);
|
||||
encode_kind(ebml_w, 'n' as u8);
|
||||
ebml::end_tag(ebml_w);
|
||||
}
|
||||
case (ast::item_ty(?id, _, ?tps, ?did, ?ann)) {
|
||||
case (ast::item_ty(?id, _, ?tps, _, ?did, ?ann)) {
|
||||
ebml::start_tag(ebml_w, tag_items_data_item);
|
||||
encode_def_id(ebml_w, did);
|
||||
encode_kind(ebml_w, 'y' as u8);
|
||||
@ -580,7 +580,7 @@ fn encode_info_for_item(@trans::crate_ctxt cx, &ebml::writer ebml_w,
|
||||
encode_type(cx, ebml_w, trans::node_ann_type(cx, ann));
|
||||
ebml::end_tag(ebml_w);
|
||||
}
|
||||
case (ast::item_tag(?id, ?variants, ?tps, ?did, ?ann)) {
|
||||
case (ast::item_tag(?id, ?variants, ?tps, _, ?did, ?ann)) {
|
||||
ebml::start_tag(ebml_w, tag_items_data_item);
|
||||
encode_def_id(ebml_w, did);
|
||||
encode_kind(ebml_w, 't' as u8);
|
||||
@ -593,7 +593,7 @@ fn encode_info_for_item(@trans::crate_ctxt cx, &ebml::writer ebml_w,
|
||||
|
||||
encode_tag_variant_info(cx, ebml_w, did, variants, index, tps);
|
||||
}
|
||||
case (ast::item_obj(?id, _, ?tps, ?odid, ?ann)) {
|
||||
case (ast::item_obj(?id, _, ?tps, _, ?odid, ?ann)) {
|
||||
ebml::start_tag(ebml_w, tag_items_data_item);
|
||||
encode_def_id(ebml_w, odid.ctor);
|
||||
encode_kind(ebml_w, 'o' as u8);
|
||||
|
@ -166,7 +166,7 @@ fn map_crate(&@env e, &@ast::crate c) {
|
||||
=new_str_hash[import_state]()));
|
||||
e.ast_map.insert(defid, i);
|
||||
}
|
||||
case (ast::item_native_mod(_, ?nmd, ?defid)) {
|
||||
case (ast::item_native_mod(_, ?nmd, _, ?defid)) {
|
||||
e.mod_map.insert(defid._1,
|
||||
@rec(m=none[ast::_mod],
|
||||
index=index_nmod(nmd),
|
||||
@ -175,19 +175,19 @@ fn map_crate(&@env e, &@ast::crate c) {
|
||||
=new_str_hash[import_state]()));
|
||||
e.ast_map.insert(defid, i);
|
||||
}
|
||||
case (ast::item_const(_, _, _, ?defid, _)) {
|
||||
case (ast::item_const(_, _, _, _, ?defid, _)) {
|
||||
e.ast_map.insert(defid, i);
|
||||
}
|
||||
case (ast::item_fn(_, _, _, ?defid, _)) {
|
||||
case (ast::item_fn(_, _, _, _, ?defid, _)) {
|
||||
e.ast_map.insert(defid, i);
|
||||
}
|
||||
case (ast::item_ty(_, _, _, ?defid, _)) {
|
||||
case (ast::item_ty(_, _, _, _, ?defid, _)) {
|
||||
e.ast_map.insert(defid, i);
|
||||
}
|
||||
case (ast::item_tag(_, _, _, ?defid, _)) {
|
||||
case (ast::item_tag(_, _, _, _, ?defid, _)) {
|
||||
e.ast_map.insert(defid, i);
|
||||
}
|
||||
case (ast::item_obj(_, _, _, ?obj_def_ids, _)) {
|
||||
case (ast::item_obj(_, _, _, _, ?obj_def_ids, _)) {
|
||||
e.ast_map.insert(obj_def_ids.ty, i);
|
||||
e.ast_map.insert(obj_def_ids.ctor, i);
|
||||
}
|
||||
@ -210,7 +210,7 @@ fn map_crate(&@env e, &@ast::crate c) {
|
||||
case (ast::item_mod(_, _, _, ?defid)) {
|
||||
ret e.mod_map.get(defid._1);
|
||||
}
|
||||
case (ast::item_native_mod(_, _, ?defid)) {
|
||||
case (ast::item_native_mod(_, _, _, ?defid)) {
|
||||
ret e.mod_map.get(defid._1);
|
||||
}
|
||||
case (_) {
|
||||
@ -512,10 +512,10 @@ fn lookup_in_scope(&env e, scopes sc, &span sp, &ident id, namespace ns)
|
||||
}
|
||||
case (scope_item(?it)) {
|
||||
alt (it.node) {
|
||||
case (ast::item_obj(_, ?ob, ?ty_params, _, _)) {
|
||||
case (ast::item_obj(_, ?ob, ?ty_params, _, _, _)) {
|
||||
ret lookup_in_obj(id, ob, ty_params, ns);
|
||||
}
|
||||
case (ast::item_tag(_, _, ?ty_params, _, _)) {
|
||||
case (ast::item_tag(_, _, ?ty_params, _, _, _)) {
|
||||
if (ns == ns_type) {
|
||||
ret lookup_in_ty_params(id, ty_params);
|
||||
}
|
||||
@ -523,10 +523,10 @@ fn lookup_in_scope(&env e, scopes sc, &span sp, &ident id, namespace ns)
|
||||
case (ast::item_mod(_, _, _, ?defid)) {
|
||||
ret lookup_in_local_mod(e, defid, sp, id, ns, inside);
|
||||
}
|
||||
case (ast::item_native_mod(_, ?m, ?defid)) {
|
||||
case (ast::item_native_mod(_, ?m, _, ?defid)) {
|
||||
ret lookup_in_local_native_mod(e, defid, sp, id, ns);
|
||||
}
|
||||
case (ast::item_ty(_, _, ?ty_params, _, _)) {
|
||||
case (ast::item_ty(_, _, ?ty_params, _, _, _)) {
|
||||
if (ns == ns_type) {
|
||||
ret lookup_in_ty_params(id, ty_params);
|
||||
}
|
||||
@ -673,7 +673,7 @@ fn lookup_in_block(&ident id, &ast::block_ b, namespace ns)
|
||||
case (ast::decl_item(?it)) {
|
||||
alt (it.node) {
|
||||
case (ast::item_tag(?name, ?variants, _,
|
||||
?defid, _)) {
|
||||
_, ?defid, _)) {
|
||||
if (ns == ns_type) {
|
||||
if (str::eq(name, id)) {
|
||||
ret some(ast::def_ty(defid));
|
||||
@ -705,25 +705,25 @@ fn lookup_in_block(&ident id, &ast::block_ b, namespace ns)
|
||||
|
||||
fn found_def_item(&@ast::item i, namespace ns) -> option::t[def] {
|
||||
alt (i.node) {
|
||||
case (ast::item_const(_, _, _, ?defid, _)) {
|
||||
case (ast::item_const(_, _, _, _, ?defid, _)) {
|
||||
if (ns == ns_value) { ret some(ast::def_const(defid)); }
|
||||
}
|
||||
case (ast::item_fn(_, _, _, ?defid, _)) {
|
||||
case (ast::item_fn(_, _, _, _, ?defid, _)) {
|
||||
if (ns == ns_value) { ret some(ast::def_fn(defid)); }
|
||||
}
|
||||
case (ast::item_mod(_, _, _, ?defid)) {
|
||||
if (ns == ns_module) { ret some(ast::def_mod(defid)); }
|
||||
}
|
||||
case (ast::item_native_mod(_, _, ?defid)) {
|
||||
case (ast::item_native_mod(_, _, _, ?defid)) {
|
||||
if (ns == ns_module) { ret some(ast::def_native_mod(defid)); }
|
||||
}
|
||||
case (ast::item_ty(_, _, _, ?defid, _)) {
|
||||
case (ast::item_ty(_, _, _, _, ?defid, _)) {
|
||||
if (ns == ns_type) { ret some(ast::def_ty(defid)); }
|
||||
}
|
||||
case (ast::item_tag(_, _, _, ?defid, _)) {
|
||||
case (ast::item_tag(_, _, _, _, ?defid, _)) {
|
||||
if (ns == ns_type) { ret some(ast::def_ty(defid)); }
|
||||
}
|
||||
case (ast::item_obj(_, _, _, ?odid, _)) {
|
||||
case (ast::item_obj(_, _, _, _, ?odid, _)) {
|
||||
alt (ns) {
|
||||
case (ns_value) { ret some(ast::def_obj(odid.ctor)); }
|
||||
case (ns_type) { ret some(ast::def_obj(odid.ty)); }
|
||||
@ -906,7 +906,7 @@ fn lookup_in_mie(&env e, &mod_index_entry mie, namespace ns)
|
||||
}
|
||||
case (mie_tag_variant(?item, ?variant_idx)) {
|
||||
alt (item.node) {
|
||||
case (ast::item_tag(_, ?variants, _, ?tid, _)) {
|
||||
case (ast::item_tag(_, ?variants, _, _, ?tid, _)) {
|
||||
if (ns == ns_value) {
|
||||
auto vid = variants.(variant_idx).node.id;
|
||||
ret some(ast::def_variant(tid, vid));
|
||||
@ -970,22 +970,22 @@ fn index_mod(&ast::_mod md) -> mod_index {
|
||||
|
||||
for (@ast::item it in md.items) {
|
||||
alt (it.node) {
|
||||
case (ast::item_const(?id, _, _, _, _)) {
|
||||
case (ast::item_const(?id, _, _, _, _, _)) {
|
||||
add_to_index(index, id, mie_item(it));
|
||||
}
|
||||
case (ast::item_fn(?id, _, _, _, _)) {
|
||||
case (ast::item_fn(?id, _, _, _, _, _)) {
|
||||
add_to_index(index, id, mie_item(it));
|
||||
}
|
||||
case (ast::item_mod(?id, _, _, _)) {
|
||||
add_to_index(index, id, mie_item(it));
|
||||
}
|
||||
case (ast::item_native_mod(?id, _, _)) {
|
||||
case (ast::item_native_mod(?id, _, _, _)) {
|
||||
add_to_index(index, id, mie_item(it));
|
||||
}
|
||||
case (ast::item_ty(?id, _, _, _, _)) {
|
||||
case (ast::item_ty(?id, _, _, _, _, _)) {
|
||||
add_to_index(index, id, mie_item(it));
|
||||
}
|
||||
case (ast::item_tag(?id, ?variants, _, _, _)) {
|
||||
case (ast::item_tag(?id, ?variants, _, _, _, _)) {
|
||||
add_to_index(index, id, mie_item(it));
|
||||
let uint variant_idx = 0u;
|
||||
for (ast::variant v in variants) {
|
||||
@ -994,7 +994,7 @@ fn index_mod(&ast::_mod md) -> mod_index {
|
||||
variant_idx += 1u;
|
||||
}
|
||||
}
|
||||
case (ast::item_obj(?id, _, _, _, _)) {
|
||||
case (ast::item_obj(?id, _, _, _, _, _)) {
|
||||
add_to_index(index, id, mie_item(it));
|
||||
}
|
||||
}
|
||||
@ -1122,11 +1122,11 @@ fn mie_span(&mod_index_entry mie) -> span {
|
||||
fn check_item(@env e, &@ast::item i, &() x, &vt[()] v) {
|
||||
visit::visit_item(i, x, v);
|
||||
alt (i.node) {
|
||||
case (ast::item_fn(_, ?f, ?ty_params, _, _)) {
|
||||
case (ast::item_fn(_, ?f, ?ty_params, _, _, _)) {
|
||||
check_fn(*e, i.span, f);
|
||||
ensure_unique(*e, i.span, ty_params, ident_id, "type parameter");
|
||||
}
|
||||
case (ast::item_obj(_, ?ob, ?ty_params, _, _)) {
|
||||
case (ast::item_obj(_, ?ob, ?ty_params, _, _, _)) {
|
||||
fn field_name(&ast::obj_field field) -> ident {
|
||||
ret field.ident;
|
||||
}
|
||||
@ -1136,7 +1136,7 @@ fn check_item(@env e, &@ast::item i, &() x, &vt[()] v) {
|
||||
}
|
||||
ensure_unique(*e, i.span, ty_params, ident_id, "type parameter");
|
||||
}
|
||||
case (ast::item_tag(_, _, ?ty_params, _, _)) {
|
||||
case (ast::item_tag(_, _, ?ty_params, _, _, _)) {
|
||||
ensure_unique(*e, i.span, ty_params, ident_id, "type parameter");
|
||||
}
|
||||
case (_) {}
|
||||
@ -1177,28 +1177,29 @@ fn check_block(@env e, &ast::block b, &() x, &vt[()] v) {
|
||||
}
|
||||
case (ast::decl_item(?it)) {
|
||||
alt (it.node) {
|
||||
case (ast::item_tag(?name, ?variants, _, _, _)) {
|
||||
case (ast::item_tag(?name, ?variants,
|
||||
_, _, _, _)) {
|
||||
add_name(types, it.span, name);
|
||||
for (ast::variant v in variants) {
|
||||
add_name(values, v.span, v.node.name);
|
||||
}
|
||||
}
|
||||
case (ast::item_const(?name, _, _, _, _)) {
|
||||
case (ast::item_const(?name, _, _, _, _, _)) {
|
||||
add_name(values, it.span, name);
|
||||
}
|
||||
case (ast::item_fn(?name, _, _, _, _)) {
|
||||
case (ast::item_fn(?name, _, _, _, _, _)) {
|
||||
add_name(values, it.span, name);
|
||||
}
|
||||
case (ast::item_mod(?name, _, _, _)) {
|
||||
add_name(mods, it.span, name);
|
||||
}
|
||||
case (ast::item_native_mod(?name, _, _)) {
|
||||
case (ast::item_native_mod(?name, _, _, _)) {
|
||||
add_name(mods, it.span, name);
|
||||
}
|
||||
case (ast::item_ty(?name, _, _, _, _)) {
|
||||
case (ast::item_ty(?name, _, _, _, _, _)) {
|
||||
add_name(types, it.span, name);
|
||||
}
|
||||
case (ast::item_obj(?name, _, _, _, _)) {
|
||||
case (ast::item_obj(?name, _, _, _, _, _)) {
|
||||
add_name(types, it.span, name);
|
||||
add_name(values, it.span, name);
|
||||
}
|
||||
|
@ -8153,13 +8153,13 @@ fn trans_const(&@crate_ctxt cx, @ast::expr e,
|
||||
|
||||
fn trans_item(@local_ctxt cx, &ast::item item) {
|
||||
alt (item.node) {
|
||||
case (ast::item_fn(?name, ?f, ?tps, ?fid, ?ann)) {
|
||||
case (ast::item_fn(?name, ?f, ?tps, _, ?fid, ?ann)) {
|
||||
auto sub_cx = extend_path(cx, name);
|
||||
auto llfndecl = cx.ccx.item_ids.get(fid);
|
||||
trans_fn(sub_cx, item.span, f, llfndecl, none[ty_self_pair],
|
||||
tps, ann);
|
||||
}
|
||||
case (ast::item_obj(?name, ?ob, ?tps, ?oid, ?ann)) {
|
||||
case (ast::item_obj(?name, ?ob, ?tps, _, ?oid, ?ann)) {
|
||||
auto sub_cx = @rec(obj_typarams=tps,
|
||||
obj_fields=ob.fields with
|
||||
*extend_path(cx, name));
|
||||
@ -8171,7 +8171,7 @@ fn trans_item(@local_ctxt cx, &ast::item item) {
|
||||
with *cx);
|
||||
trans_mod(sub_cx, m);
|
||||
}
|
||||
case (ast::item_tag(?name, ?variants, ?tps, ?tag_id, _)) {
|
||||
case (ast::item_tag(?name, ?variants, ?tps, _, ?tag_id, _)) {
|
||||
auto sub_cx = extend_path(cx, name);
|
||||
auto i = 0;
|
||||
for (ast::variant variant in variants) {
|
||||
@ -8179,7 +8179,7 @@ fn trans_item(@local_ctxt cx, &ast::item item) {
|
||||
i += 1;
|
||||
}
|
||||
}
|
||||
case (ast::item_const(?name, _, ?expr, ?cid, ?ann)) {
|
||||
case (ast::item_const(?name, _, ?expr, _, ?cid, ?ann)) {
|
||||
trans_const(cx.ccx, expr, cid, ann);
|
||||
}
|
||||
case (_) { /* fall through */ }
|
||||
@ -8486,8 +8486,8 @@ fn decl_native_fn_and_pair(&@crate_ctxt ccx,
|
||||
|
||||
fn item_path(&@ast::item item) -> vec[str] {
|
||||
alt (item.node) {
|
||||
case (ast::item_fn(?name, _, _, _, _)) { ret [name]; }
|
||||
case (ast::item_obj(?name, _, _, _, _)) { ret [name]; }
|
||||
case (ast::item_fn(?name, _, _, _, _, _)) { ret [name]; }
|
||||
case (ast::item_obj(?name, _, _, _, _, _)) { ret [name]; }
|
||||
case (ast::item_mod(?name, _, _, _)) { ret [name]; }
|
||||
case (_) { ret []; }
|
||||
}
|
||||
@ -8512,7 +8512,7 @@ fn collect_item_1(@crate_ctxt ccx, &@ast::item i,
|
||||
&vec[str] pt, &vt[vec[str]] v) {
|
||||
visit::visit_item(i, pt + item_path(i), v);
|
||||
alt (i.node) {
|
||||
case (ast::item_const(?name, _, _, ?cid, ?ann)) {
|
||||
case (ast::item_const(?name, _, _, _, ?cid, ?ann)) {
|
||||
auto typ = node_ann_type(ccx, ann);
|
||||
auto g = llvm::LLVMAddGlobal(ccx.llmod, type_of(ccx, i.span, typ),
|
||||
str::buf(ccx.names.next(name)));
|
||||
@ -8524,13 +8524,13 @@ fn collect_item_1(@crate_ctxt ccx, &@ast::item i,
|
||||
case (ast::item_mod(?name, ?m, _, ?mid)) {
|
||||
ccx.items.insert(mid, i);
|
||||
}
|
||||
case (ast::item_native_mod(_, _, ?mid)) {
|
||||
case (ast::item_native_mod(_, _, _, ?mid)) {
|
||||
ccx.items.insert(mid, i);
|
||||
}
|
||||
case (ast::item_ty(_, _, _, ?did, _)) {
|
||||
case (ast::item_ty(_, _, _, _, ?did, _)) {
|
||||
ccx.items.insert(did, i);
|
||||
}
|
||||
case (ast::item_tag(?name, ?variants, ?tps, ?tag_id, _)) {
|
||||
case (ast::item_tag(?name, ?variants, ?tps, _, ?tag_id, _)) {
|
||||
ccx.items.insert(tag_id, i);
|
||||
}
|
||||
case (_) {}
|
||||
@ -8542,13 +8542,13 @@ fn collect_item_2(&@crate_ctxt ccx, &@ast::item i,
|
||||
auto new_pt = pt + item_path(i);
|
||||
visit::visit_item(i, new_pt, v);
|
||||
alt (i.node) {
|
||||
case (ast::item_fn(?name, ?f, ?tps, ?fid, ?ann)) {
|
||||
case (ast::item_fn(?name, ?f, ?tps, _, ?fid, ?ann)) {
|
||||
ccx.items.insert(fid, i);
|
||||
if (!ccx.obj_methods.contains_key(fid)) {
|
||||
decl_fn_and_pair(ccx, i.span, new_pt, "fn", tps, ann, fid);
|
||||
}
|
||||
}
|
||||
case (ast::item_obj(?name, ?ob, ?tps, ?oid, ?ann)) {
|
||||
case (ast::item_obj(?name, ?ob, ?tps, _, ?oid, ?ann)) {
|
||||
ccx.items.insert(oid.ctor, i);
|
||||
decl_fn_and_pair(ccx, i.span, new_pt,
|
||||
"obj_ctor", tps, ann, oid.ctor);
|
||||
@ -8578,7 +8578,7 @@ fn collect_tag_ctor(@crate_ctxt ccx, &@ast::item i,
|
||||
visit::visit_item(i, new_pt, v);
|
||||
|
||||
alt (i.node) {
|
||||
case (ast::item_tag(_, ?variants, ?tps, _, _)) {
|
||||
case (ast::item_tag(_, ?variants, ?tps, _, _, _)) {
|
||||
for (ast::variant variant in variants) {
|
||||
if (vec::len[ast::variant_arg](variant.node.args) != 0u) {
|
||||
decl_fn_and_pair(ccx, i.span,
|
||||
@ -8607,7 +8607,7 @@ fn trans_constant(@crate_ctxt ccx, &@ast::item it,
|
||||
visit::visit_item(it, new_pt, v);
|
||||
|
||||
alt (it.node) {
|
||||
case (ast::item_tag(?ident, ?variants, _, ?tag_id, _)) {
|
||||
case (ast::item_tag(?ident, ?variants, _, _, ?tag_id, _)) {
|
||||
auto i = 0u;
|
||||
auto n_variants = vec::len[ast::variant](variants);
|
||||
while (i < n_variants) {
|
||||
@ -8630,7 +8630,7 @@ fn trans_constant(@crate_ctxt ccx, &@ast::item it,
|
||||
}
|
||||
}
|
||||
|
||||
case (ast::item_const(?name, _, ?expr, ?cid, ?ann)) {
|
||||
case (ast::item_const(?name, _, ?expr, _, ?cid, ?ann)) {
|
||||
// FIXME: The whole expr-translation system needs cloning to deal
|
||||
// with consts.
|
||||
auto v = C_int(1);
|
||||
|
@ -101,7 +101,7 @@ fn find_pre_post_obj(&crate_ctxt ccx, _obj o) -> () {
|
||||
|
||||
fn find_pre_post_item(&crate_ctxt ccx, &item i) -> () {
|
||||
alt (i.node) {
|
||||
case (item_const(?id, ?t, ?e, ?di, ?a)) {
|
||||
case (item_const(?id, ?t, ?e, _, ?di, ?a)) {
|
||||
// make a fake fcx
|
||||
auto fake_fcx = rec(enclosing=
|
||||
rec(constrs=@new_def_hash[constraint](),
|
||||
@ -112,7 +112,7 @@ fn find_pre_post_item(&crate_ctxt ccx, &item i) -> () {
|
||||
ccx=ccx);
|
||||
find_pre_post_expr(fake_fcx, e);
|
||||
}
|
||||
case (item_fn(?id, ?f, ?ps, ?di, ?a)) {
|
||||
case (item_fn(?id, ?f, ?ps, _, ?di, ?a)) {
|
||||
assert (ccx.fm.contains_key(di));
|
||||
auto fcx = rec(enclosing=ccx.fm.get(di),
|
||||
id=di, name=id, ccx=ccx);
|
||||
@ -121,16 +121,16 @@ fn find_pre_post_item(&crate_ctxt ccx, &item i) -> () {
|
||||
case (item_mod(?id, ?m, _, ?di)) {
|
||||
find_pre_post_mod(m);
|
||||
}
|
||||
case (item_native_mod(?id, ?nm, ?di)) {
|
||||
case (item_native_mod(?id, ?nm, _, ?di)) {
|
||||
find_pre_post_native_mod(nm);
|
||||
}
|
||||
case (item_ty(_,_,_,_,_)) {
|
||||
case (item_ty(_,_,_,_,_,_)) {
|
||||
ret;
|
||||
}
|
||||
case (item_tag(_,_,_,_,_)) {
|
||||
case (item_tag(_,_,_,_,_,_)) {
|
||||
ret;
|
||||
}
|
||||
case (item_obj(?id, ?o, ?ps, ?di, ?a)) {
|
||||
case (item_obj(?id, ?o, ?ps, _, ?di, ?a)) {
|
||||
find_pre_post_obj(ccx, o);
|
||||
}
|
||||
}
|
||||
|
@ -1627,21 +1627,21 @@ fn pat_ty(&ctxt cx, &@ast::pat pat) -> t {
|
||||
|
||||
fn item_ann(&@ast::item it) -> ast::ann {
|
||||
alt (it.node) {
|
||||
case (ast::item_const(_,_,_,_,?a)) { ret a; }
|
||||
case (ast::item_fn(_,_,_,_,?a)) { ret a; }
|
||||
case (ast::item_const(_,_,_,_,_,?a)) { ret a; }
|
||||
case (ast::item_fn(_,_,_,_,_,?a)) { ret a; }
|
||||
case (ast::item_mod(_,_,_, _)) {
|
||||
log_err "a module was passed to item_ann(), " +
|
||||
"but modules haven't annotations";
|
||||
fail;
|
||||
}
|
||||
case (ast::item_native_mod(_,_,_)) {
|
||||
case (ast::item_native_mod(_,_,_,_)) {
|
||||
log_err "a native module was passed to item_ann(), " +
|
||||
"but native modules haven't annotations";
|
||||
fail;
|
||||
}
|
||||
case (ast::item_ty(_,_,_,_,?a)) { ret a; }
|
||||
case (ast::item_tag(_,_,_,_,?a)) { ret a; }
|
||||
case (ast::item_obj(_,_,_,_,?a)) { ret a; }
|
||||
case (ast::item_ty(_,_,_,_,_,?a)) { ret a; }
|
||||
case (ast::item_tag(_,_,_,_,_,?a)) { ret a; }
|
||||
case (ast::item_obj(_,_,_,_,_,?a)) { ret a; }
|
||||
}
|
||||
}
|
||||
|
||||
@ -2720,7 +2720,7 @@ fn tag_variants(&ctxt cx, &ast::def_id id) -> vec[variant_info] {
|
||||
alt (cx.items.get(id)) {
|
||||
case (any_item_rust(?item)) {
|
||||
alt (item.node) {
|
||||
case (ast::item_tag(_, ?variants, _, _, _)) {
|
||||
case (ast::item_tag(_, ?variants, _, _, _, _)) {
|
||||
let vec[variant_info] result = [];
|
||||
for (ast::variant variant in variants) {
|
||||
auto ctor_ty = ann_to_monotype(cx, variant.node.ann);
|
||||
|
@ -593,26 +593,26 @@ mod collect {
|
||||
|
||||
alt (it.node) {
|
||||
|
||||
case (ast::item_const(?ident, ?t, _, ?def_id, _)) {
|
||||
case (ast::item_const(?ident, ?t, _, _, ?def_id, _)) {
|
||||
auto typ = convert(t);
|
||||
auto tpt = tup(0u, typ);
|
||||
cx.tcx.tcache.insert(def_id, tpt);
|
||||
ret tpt;
|
||||
}
|
||||
|
||||
case (ast::item_fn(?ident, ?fn_info, ?tps, ?def_id, _)) {
|
||||
case (ast::item_fn(?ident, ?fn_info, ?tps, _, ?def_id, _)) {
|
||||
auto f = bind ty_of_arg(cx, _);
|
||||
ret ty_of_fn_decl(cx, convert, f, fn_info.decl, fn_info.proto,
|
||||
tps, some(def_id));
|
||||
}
|
||||
|
||||
case (ast::item_obj(?ident, ?obj_info, ?tps, ?odid, _)) {
|
||||
case (ast::item_obj(?ident, ?obj_info, ?tps, _, ?odid, _)) {
|
||||
auto t_obj = ty_of_obj(cx, ident, obj_info, tps);
|
||||
cx.tcx.tcache.insert(odid.ty, t_obj);
|
||||
ret t_obj;
|
||||
}
|
||||
|
||||
case (ast::item_ty(?ident, ?t, ?tps, ?def_id, _)) {
|
||||
case (ast::item_ty(?ident, ?t, ?tps, _, ?def_id, _)) {
|
||||
alt (cx.tcx.tcache.find(def_id)) {
|
||||
case (some(?tpt)) {
|
||||
ret tpt;
|
||||
@ -629,7 +629,7 @@ mod collect {
|
||||
ret tpt;
|
||||
}
|
||||
|
||||
case (ast::item_tag(_, _, ?tps, ?def_id, _)) {
|
||||
case (ast::item_tag(_, _, ?tps, _, ?def_id, _)) {
|
||||
// Create a new generic polytype.
|
||||
let vec[ty::t] subtys = [];
|
||||
|
||||
@ -648,7 +648,7 @@ mod collect {
|
||||
}
|
||||
|
||||
case (ast::item_mod(_, _, _, _)) { fail; }
|
||||
case (ast::item_native_mod(_, _, _)) { fail; }
|
||||
case (ast::item_native_mod(_, _, _, _)) { fail; }
|
||||
}
|
||||
}
|
||||
|
||||
@ -729,13 +729,13 @@ mod collect {
|
||||
|
||||
fn collect(ty::item_table id_to_ty_item, &@ast::item i) {
|
||||
alt (i.node) {
|
||||
case (ast::item_ty(_, _, _, ?def_id, _)) {
|
||||
case (ast::item_ty(_, _, _, _, ?def_id, _)) {
|
||||
id_to_ty_item.insert(def_id, ty::any_item_rust(i));
|
||||
}
|
||||
case (ast::item_tag(_, _, _, ?def_id, _)) {
|
||||
case (ast::item_tag(_, _, _, _, ?def_id, _)) {
|
||||
id_to_ty_item.insert(def_id, ty::any_item_rust(i));
|
||||
}
|
||||
case (ast::item_obj(_, _, _, ?odid, _)) {
|
||||
case (ast::item_obj(_, _, _, _, ?odid, _)) {
|
||||
id_to_ty_item.insert(odid.ty, ty::any_item_rust(i));
|
||||
}
|
||||
case (_) { /* empty */ }
|
||||
@ -759,18 +759,19 @@ mod collect {
|
||||
case (ast::item_mod(_, _, _, _)) {
|
||||
// ignore item_mod, it has no type.
|
||||
}
|
||||
case (ast::item_native_mod(_, ?native_mod, _)) {
|
||||
case (ast::item_native_mod(_, ?native_mod, _, _)) {
|
||||
// Propagate the native ABI down to convert_native() below,
|
||||
// but otherwise do nothing, as native modules have no types.
|
||||
*abi = some[ast::native_abi](native_mod.abi);
|
||||
}
|
||||
case (ast::item_tag(_, ?variants, ?ty_params, ?tag_id, ?ann)) {
|
||||
case (ast::item_tag(_, ?variants, ?ty_params, _, ?tag_id, ?ann)) {
|
||||
auto tpt = ty_of_item(cx, it);
|
||||
write::ty_only(cx.tcx, ann.id, tpt._1);
|
||||
|
||||
get_tag_variant_types(cx, tag_id, variants, ty_params);
|
||||
}
|
||||
case (ast::item_obj(?ident, ?object, ?ty_params, ?odid, ?ann)) {
|
||||
case (ast::item_obj(?ident, ?object,
|
||||
?ty_params, _, ?odid, ?ann)) {
|
||||
// This calls ty_of_obj().
|
||||
auto t_obj = ty_of_item(cx, it);
|
||||
|
||||
@ -2511,13 +2512,13 @@ fn check_method(&@crate_ctxt ccx, &@ast::method method) {
|
||||
|
||||
fn check_item(@crate_ctxt ccx, &@ast::item it) {
|
||||
alt (it.node) {
|
||||
case (ast::item_const(_, _, ?e, _, ?a)) {
|
||||
case (ast::item_const(_, _, ?e, _, _, ?a)) {
|
||||
check_const(ccx, it.span, e, a);
|
||||
}
|
||||
case (ast::item_fn(_, ?f, _, _, ?a)) {
|
||||
case (ast::item_fn(_, ?f, _, _, _, ?a)) {
|
||||
check_fn(ccx, f.decl, f.proto, f.body, a);
|
||||
}
|
||||
case (ast::item_obj(_, ?ob, _, ?obj_def_ids, _)) {
|
||||
case (ast::item_obj(_, ?ob, _, _, ?obj_def_ids, _)) {
|
||||
// We're entering an object, so gather up the info we need.
|
||||
let ast::def_id di = obj_def_ids.ty;
|
||||
vec::push[obj_info](ccx.obj_infos,
|
||||
@ -2541,7 +2542,7 @@ fn mk_fn_purity_table(&@ast::crate crate) -> @fn_purity_table {
|
||||
|
||||
fn do_one(@fn_purity_table t, &@ast::item i) -> () {
|
||||
alt (i.node) {
|
||||
case (ast::item_fn(_, ?f, _, ?d_id, _)) {
|
||||
case (ast::item_fn(_, ?f, _, _, ?d_id, _)) {
|
||||
t.insert(d_id, f.decl.purity);
|
||||
}
|
||||
case (_) {}
|
||||
|
@ -104,17 +104,17 @@ fn visit_local[E](&@local loc, &E e, &vt[E] v) {
|
||||
|
||||
fn visit_item[E](&@item i, &E e, &vt[E] v) {
|
||||
alt (i.node) {
|
||||
case (item_const(_, ?t, ?ex, _, _)) {
|
||||
case (item_const(_, ?t, ?ex, _, _, _)) {
|
||||
vt(v).visit_ty(t, e, v);
|
||||
vt(v).visit_expr(ex, e, v);
|
||||
}
|
||||
case (item_fn(?nm, ?f, ?tp, ?d, ?a)) {
|
||||
case (item_fn(?nm, ?f, ?tp, _, ?d, ?a)) {
|
||||
vt(v).visit_fn(f, tp, i.span, nm, d, a, e, v);
|
||||
}
|
||||
case (item_mod(_, ?m, _, _)) {
|
||||
vt(v).visit_mod(m, i.span, e, v);
|
||||
}
|
||||
case (item_native_mod(_, ?nm, _)) {
|
||||
case (item_native_mod(_, ?nm, _, _)) {
|
||||
for (@view_item vi in nm.view_items) {
|
||||
vt(v).visit_view_item(vi, e, v);
|
||||
}
|
||||
@ -122,17 +122,17 @@ fn visit_item[E](&@item i, &E e, &vt[E] v) {
|
||||
vt(v).visit_native_item(ni, e, v);
|
||||
}
|
||||
}
|
||||
case (item_ty(_, ?t, _, _, _)) {
|
||||
case (item_ty(_, ?t, _, _, _, _)) {
|
||||
vt(v).visit_ty(t, e, v);
|
||||
}
|
||||
case (item_tag(_, ?variants, _, _, _)) {
|
||||
case (item_tag(_, ?variants, _, _, _, _)) {
|
||||
for (variant vr in variants) {
|
||||
for (variant_arg va in vr.node.args) {
|
||||
vt(v).visit_ty(va.ty, e, v);
|
||||
}
|
||||
}
|
||||
}
|
||||
case (item_obj(_, ?ob, _, _, _)) {
|
||||
case (item_obj(_, ?ob, _, _, _, _)) {
|
||||
for (obj_field f in ob.fields) {
|
||||
vt(v).visit_ty(f.ty, e, v);
|
||||
}
|
||||
|
@ -114,30 +114,30 @@ fn walk_item(&ast_visitor v, @ast::item i) {
|
||||
if (!v.keep_going()) { ret; }
|
||||
v.visit_item_pre(i);
|
||||
alt (i.node) {
|
||||
case (ast::item_const(_, ?t, ?e, _, _)) {
|
||||
case (ast::item_const(_, ?t, ?e, _, _, _)) {
|
||||
walk_ty(v, t);
|
||||
walk_expr(v, e);
|
||||
}
|
||||
case (ast::item_fn(?nm, ?f, _, ?d, ?a)) {
|
||||
case (ast::item_fn(?nm, ?f, _, _, ?d, ?a)) {
|
||||
walk_fn(v, f, i.span, nm, d, a);
|
||||
}
|
||||
case (ast::item_mod(_, ?m, _, _)) {
|
||||
walk_mod(v, m);
|
||||
}
|
||||
case (ast::item_native_mod(_, ?nm, _)) {
|
||||
case (ast::item_native_mod(_, ?nm, _, _)) {
|
||||
walk_native_mod(v, nm);
|
||||
}
|
||||
case (ast::item_ty(_, ?t, _, _, _)) {
|
||||
case (ast::item_ty(_, ?t, _, _, _, _)) {
|
||||
walk_ty(v, t);
|
||||
}
|
||||
case (ast::item_tag(_, ?variants, _, _, _)) {
|
||||
case (ast::item_tag(_, ?variants, _, _, _, _)) {
|
||||
for (ast::variant vr in variants) {
|
||||
for (ast::variant_arg va in vr.node.args) {
|
||||
walk_ty(v, va.ty);
|
||||
}
|
||||
}
|
||||
}
|
||||
case (ast::item_obj(_, ?ob, _, _, _)) {
|
||||
case (ast::item_obj(_, ?ob, _, _, _, _)) {
|
||||
for (ast::obj_field f in ob.fields) {
|
||||
walk_ty(v, f.ty);
|
||||
}
|
||||
|
@ -257,7 +257,7 @@ fn print_item(&ps s, &@ast::item item) {
|
||||
hardbreak(s.s);
|
||||
maybe_print_comment(s, item.span.lo);
|
||||
alt (item.node) {
|
||||
case (ast::item_const(?id, ?ty, ?expr, _, _)) {
|
||||
case (ast::item_const(?id, ?ty, ?expr, _, _, _)) {
|
||||
head(s, "const");
|
||||
print_type(s, *ty);
|
||||
space(s.s);
|
||||
@ -268,7 +268,7 @@ fn print_item(&ps s, &@ast::item item) {
|
||||
word(s.s, ";");
|
||||
end(s); // end the outer cbox
|
||||
}
|
||||
case (ast::item_fn(?name,?_fn,?typarams,_,_)) {
|
||||
case (ast::item_fn(?name,?_fn,?typarams,_,_,_)) {
|
||||
print_fn(s, _fn.decl, _fn.proto, name, typarams);
|
||||
word(s.s, " ");
|
||||
print_block(s, _fn.body);
|
||||
@ -280,7 +280,7 @@ fn print_item(&ps s, &@ast::item item) {
|
||||
for (@ast::item itm in _mod.items) {print_item(s, itm);}
|
||||
bclose(s, item.span);
|
||||
}
|
||||
case (ast::item_native_mod(?id,?nmod,_)) {
|
||||
case (ast::item_native_mod(?id,?nmod,_,_)) {
|
||||
head(s, "native");
|
||||
alt (nmod.abi) {
|
||||
case (ast::native_abi_rust) {word_nbsp(s, "\"rust\"");}
|
||||
@ -317,7 +317,7 @@ fn print_item(&ps s, &@ast::item item) {
|
||||
}
|
||||
bclose(s, item.span);
|
||||
}
|
||||
case (ast::item_ty(?id,?ty,?params,_,_)) {
|
||||
case (ast::item_ty(?id,?ty,?params,_,_,_)) {
|
||||
ibox(s, indent_unit);
|
||||
ibox(s, 0u);
|
||||
word_nbsp(s, "type");
|
||||
@ -331,7 +331,7 @@ fn print_item(&ps s, &@ast::item item) {
|
||||
end(s); // end the outer ibox
|
||||
break_offset(s.s, 0u, 0);
|
||||
}
|
||||
case (ast::item_tag(?id,?variants,?params,_,_)) {
|
||||
case (ast::item_tag(?id,?variants,?params,_,_,_)) {
|
||||
head(s, "tag");
|
||||
word(s.s, id);
|
||||
print_type_params(s, params);
|
||||
@ -354,7 +354,7 @@ fn print_item(&ps s, &@ast::item item) {
|
||||
}
|
||||
bclose(s, item.span);
|
||||
}
|
||||
case (ast::item_obj(?id,?_obj,?params,_,_)) {
|
||||
case (ast::item_obj(?id,?_obj,?params,_,_,_)) {
|
||||
head(s, "obj");
|
||||
word(s.s, id);
|
||||
print_type_params(s, params);
|
||||
|
@ -181,25 +181,25 @@ fn decl_lhs(@ast::decl d) -> ast::def_id {
|
||||
}
|
||||
case (ast::decl_item(?an_item)) {
|
||||
alt (an_item.node) {
|
||||
case (ast::item_const(_,_,_,?d,_)) {
|
||||
case (ast::item_const(_,_,_,_,?d,_)) {
|
||||
ret d;
|
||||
}
|
||||
case (ast::item_fn(_,_,_,?d,_)) {
|
||||
case (ast::item_fn(_,_,_,_,?d,_)) {
|
||||
ret d;
|
||||
}
|
||||
case (ast::item_mod(_,_,_,?d)) {
|
||||
ret d;
|
||||
}
|
||||
case (ast::item_native_mod(_,_,?d)) {
|
||||
case (ast::item_native_mod(_,_,_,?d)) {
|
||||
ret d;
|
||||
}
|
||||
case (ast::item_ty(_,_,_,?d,_)) {
|
||||
case (ast::item_ty(_,_,_,_,?d,_)) {
|
||||
ret d;
|
||||
}
|
||||
case (ast::item_tag(_,_,_,?d,_)) {
|
||||
case (ast::item_tag(_,_,_,_,?d,_)) {
|
||||
ret d;
|
||||
}
|
||||
case (ast::item_obj(_,_,_,?d,_)) {
|
||||
case (ast::item_obj(_,_,_,_,?d,_)) {
|
||||
ret d.ctor; /* This doesn't really make sense */
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user