Refactor ast::item representation
Most of the fields in an AST item were present in all variants. Things could be simplified considerably by putting them in the rec rather than in the variant tags.
This commit is contained in:
parent
6c2f322f82
commit
15f71b3600
15 changed files with 311 additions and 382 deletions
|
@ -459,28 +459,21 @@ tag attr_style { attr_outer; attr_inner; }
|
||||||
|
|
||||||
type attribute_ = rec(attr_style style, meta_item value);
|
type attribute_ = rec(attr_style style, meta_item value);
|
||||||
|
|
||||||
type item = spanned[item_];
|
type item = rec(ident ident,
|
||||||
|
vec[attribute] attrs,
|
||||||
|
def_id id, // For objs, this is the type def_id
|
||||||
|
ann ann,
|
||||||
|
item_ node,
|
||||||
|
span span);
|
||||||
|
|
||||||
tag item_ {
|
tag item_ {
|
||||||
item_const(ident, @ty, @expr, vec[attribute], def_id, ann);
|
item_const(@ty, @expr);
|
||||||
item_fn(ident, _fn, vec[ty_param], vec[attribute], def_id, ann);
|
item_fn(_fn, vec[ty_param]);
|
||||||
item_mod(ident, _mod, vec[attribute], def_id);
|
item_mod(_mod);
|
||||||
item_native_mod(ident, native_mod, vec[attribute], def_id);
|
item_native_mod(native_mod);
|
||||||
item_ty(ident, @ty, vec[ty_param], vec[attribute], def_id, ann);
|
item_ty(@ty, vec[ty_param]);
|
||||||
item_tag(ident, vec[variant], vec[ty_param], vec[attribute], def_id, ann);
|
item_tag(vec[variant], vec[ty_param]);
|
||||||
item_obj(ident, _obj, vec[ty_param], vec[attribute], obj_def_ids, ann);
|
item_obj(_obj, vec[ty_param], def_id /* constructor id */);
|
||||||
}
|
|
||||||
|
|
||||||
fn item_ident(@item it) -> ident {
|
|
||||||
ret alt (it.node) {
|
|
||||||
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 }
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
type native_item = spanned[native_item_];
|
type native_item = spanned[native_item_];
|
||||||
|
@ -498,15 +491,16 @@ tag native_item_ {
|
||||||
fn is_exported(ident i, _mod m) -> bool {
|
fn is_exported(ident i, _mod m) -> bool {
|
||||||
auto nonlocal = true;
|
auto nonlocal = true;
|
||||||
for (@ast::item it in m.items) {
|
for (@ast::item it in m.items) {
|
||||||
if (item_ident(it) == i) { nonlocal = false; }
|
if (it.ident == i) { nonlocal = false; }
|
||||||
alt (it.node) {
|
alt (it.node) {
|
||||||
case (item_tag(_, ?variants, _, _, _, _)) {
|
case (item_tag(?variants, _)) {
|
||||||
for (variant v in variants) {
|
for (variant v in variants) {
|
||||||
if (v.node.name == i) { nonlocal = false; }
|
if (v.node.name == i) { nonlocal = false; }
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
case (_) { }
|
case (_) { }
|
||||||
}
|
}
|
||||||
|
if (!nonlocal) { break; }
|
||||||
}
|
}
|
||||||
auto count = 0u;
|
auto count = 0u;
|
||||||
for (@ast::view_item vi in m.view_items) {
|
for (@ast::view_item vi in m.view_items) {
|
||||||
|
@ -525,7 +519,7 @@ fn is_exported(ident i, _mod m) -> bool {
|
||||||
|
|
||||||
// If there are no declared exports then
|
// If there are no declared exports then
|
||||||
// everything not imported is exported
|
// everything not imported is exported
|
||||||
if (count == 0u && !nonlocal) { ret true; } else { ret false; }
|
ret count == 0u && !nonlocal;
|
||||||
}
|
}
|
||||||
|
|
||||||
fn is_call_expr(@expr e) -> bool {
|
fn is_call_expr(@expr e) -> bool {
|
||||||
|
|
|
@ -294,8 +294,8 @@ fn eval_crate_directive(ctx cx, env e, @ast::crate_directive cdir, str prefix,
|
||||||
cx.p.set_def(next_id._1);
|
cx.p.set_def(next_id._1);
|
||||||
cx.chpos = p0.get_chpos();
|
cx.chpos = p0.get_chpos();
|
||||||
cx.next_ann = p0.next_ann_num();
|
cx.next_ann = p0.next_ann_num();
|
||||||
auto im = ast::item_mod(id, m0, [], next_id);
|
auto i = front::parser::mk_item(cx.p, cdir.span.lo, cdir.span.hi,
|
||||||
auto i = @spanned(cdir.span.lo, cdir.span.hi, im);
|
id, ast::item_mod(m0), []);
|
||||||
vec::push[@ast::item](items, i);
|
vec::push[@ast::item](items, i);
|
||||||
}
|
}
|
||||||
case (ast::cdir_dir_mod(?id, ?dir_opt, ?cdirs)) {
|
case (ast::cdir_dir_mod(?id, ?dir_opt, ?cdirs)) {
|
||||||
|
@ -303,8 +303,8 @@ fn eval_crate_directive(ctx cx, env e, @ast::crate_directive cdir, str prefix,
|
||||||
alt (dir_opt) { case (some(?d)) { path = d; } case (none) { } }
|
alt (dir_opt) { case (some(?d)) { path = d; } case (none) { } }
|
||||||
auto full_path = prefix + std::fs::path_sep() + path;
|
auto full_path = prefix + std::fs::path_sep() + path;
|
||||||
auto m0 = eval_crate_directives_to_mod(cx, e, cdirs, full_path);
|
auto m0 = eval_crate_directives_to_mod(cx, e, cdirs, full_path);
|
||||||
auto im = ast::item_mod(id, m0, [], cx.p.next_def_id());
|
auto i = front::parser::mk_item
|
||||||
auto i = @spanned(cdir.span.lo, cdir.span.hi, im);
|
(cx.p, cdir.span.lo, cdir.span.hi, id, ast::item_mod(m0), []);
|
||||||
vec::push[@ast::item](items, i);
|
vec::push[@ast::item](items, i);
|
||||||
}
|
}
|
||||||
case (ast::cdir_view_item(?vi)) {
|
case (ast::cdir_view_item(?vi)) {
|
||||||
|
|
|
@ -1662,14 +1662,22 @@ fn parse_fn_header(&parser p) -> tup(ast::ident, vec[ast::ty_param]) {
|
||||||
ret tup(id, ty_params);
|
ret tup(id, ty_params);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
fn mk_item(&parser p, uint lo, uint hi, &ast::ident ident, &ast::item_ node,
|
||||||
|
&vec[ast::attribute] attrs) -> @ast::item {
|
||||||
|
ret @rec(ident=ident,
|
||||||
|
attrs=attrs,
|
||||||
|
id=p.next_def_id(),
|
||||||
|
ann=p.get_ann(),
|
||||||
|
node=node,
|
||||||
|
span=rec(lo=lo, hi=hi));
|
||||||
|
}
|
||||||
|
|
||||||
fn parse_item_fn_or_iter(&parser p, ast::purity purity, ast::proto proto,
|
fn parse_item_fn_or_iter(&parser p, ast::purity purity, ast::proto proto,
|
||||||
vec[ast::attribute] attrs) -> @ast::item {
|
vec[ast::attribute] attrs) -> @ast::item {
|
||||||
auto lo = p.get_last_lo_pos();
|
auto lo = p.get_last_lo_pos();
|
||||||
auto t = parse_fn_header(p);
|
auto t = parse_fn_header(p);
|
||||||
auto f = parse_fn(p, proto, purity);
|
auto f = parse_fn(p, proto, purity);
|
||||||
auto item =
|
ret mk_item(p, lo, f.body.span.hi, t._0, ast::item_fn(f, t._1), attrs);
|
||||||
ast::item_fn(t._0, f, t._1, attrs, p.next_def_id(), p.get_ann());
|
|
||||||
ret @spanned(lo, f.body.span.hi, item);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
fn parse_obj_field(&parser p) -> ast::obj_field {
|
fn parse_obj_field(&parser p) -> ast::obj_field {
|
||||||
|
@ -1727,9 +1735,8 @@ fn parse_item_obj(&parser p, ast::layer lyr, vec[ast::attribute] attrs) ->
|
||||||
auto hi = p.get_hi_pos();
|
auto hi = p.get_hi_pos();
|
||||||
expect(p, token::RBRACE);
|
expect(p, token::RBRACE);
|
||||||
let ast::_obj ob = rec(fields=fields.node, methods=meths, dtor=dtor);
|
let ast::_obj ob = rec(fields=fields.node, methods=meths, dtor=dtor);
|
||||||
auto odid = rec(ty=p.next_def_id(), ctor=p.next_def_id());
|
ret mk_item(p, lo, hi, ident, ast::item_obj(ob, ty_params,
|
||||||
auto item = ast::item_obj(ident, ob, ty_params, attrs, odid, p.get_ann());
|
p.next_def_id()), attrs);
|
||||||
ret @spanned(lo, hi, item);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
fn parse_mod_items(&parser p, token::token term) -> ast::_mod {
|
fn parse_mod_items(&parser p, token::token term) -> ast::_mod {
|
||||||
|
@ -1756,9 +1763,7 @@ fn parse_item_const(&parser p, vec[ast::attribute] attrs) -> @ast::item {
|
||||||
auto e = parse_expr(p);
|
auto e = parse_expr(p);
|
||||||
auto hi = p.get_hi_pos();
|
auto hi = p.get_hi_pos();
|
||||||
expect(p, token::SEMI);
|
expect(p, token::SEMI);
|
||||||
auto item =
|
ret mk_item(p, lo, hi, id, ast::item_const(ty, e), attrs);
|
||||||
ast::item_const(id, ty, e, attrs, p.next_def_id(), p.get_ann());
|
|
||||||
ret @spanned(lo, hi, item);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
fn parse_item_mod(&parser p, vec[ast::attribute] attrs) -> @ast::item {
|
fn parse_item_mod(&parser p, vec[ast::attribute] attrs) -> @ast::item {
|
||||||
|
@ -1768,8 +1773,7 @@ fn parse_item_mod(&parser p, vec[ast::attribute] attrs) -> @ast::item {
|
||||||
auto m = parse_mod_items(p, token::RBRACE);
|
auto m = parse_mod_items(p, token::RBRACE);
|
||||||
auto hi = p.get_hi_pos();
|
auto hi = p.get_hi_pos();
|
||||||
expect(p, token::RBRACE);
|
expect(p, token::RBRACE);
|
||||||
auto item = ast::item_mod(id, m, attrs, p.next_def_id());
|
ret mk_item(p, lo, hi, id, ast::item_mod(m), attrs);
|
||||||
ret @spanned(lo, hi, item);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
fn parse_item_native_type(&parser p) -> @ast::native_item {
|
fn parse_item_native_type(&parser p) -> @ast::native_item {
|
||||||
|
@ -1856,8 +1860,7 @@ fn parse_item_native_mod(&parser p, vec[ast::attribute] attrs) -> @ast::item {
|
||||||
auto m = parse_native_mod_items(p, native_name, abi);
|
auto m = parse_native_mod_items(p, native_name, abi);
|
||||||
auto hi = p.get_hi_pos();
|
auto hi = p.get_hi_pos();
|
||||||
expect(p, token::RBRACE);
|
expect(p, token::RBRACE);
|
||||||
auto item = ast::item_native_mod(id, m, attrs, p.next_def_id());
|
ret mk_item(p, lo, hi, id, ast::item_native_mod(m), attrs);
|
||||||
ret @spanned(lo, hi, item);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
fn parse_type_decl(&parser p) -> tup(uint, ast::ident) {
|
fn parse_type_decl(&parser p) -> tup(uint, ast::ident) {
|
||||||
|
@ -1873,9 +1876,7 @@ fn parse_item_type(&parser p, vec[ast::attribute] attrs) -> @ast::item {
|
||||||
auto ty = parse_ty(p);
|
auto ty = parse_ty(p);
|
||||||
auto hi = p.get_hi_pos();
|
auto hi = p.get_hi_pos();
|
||||||
expect(p, token::SEMI);
|
expect(p, token::SEMI);
|
||||||
auto item =
|
ret mk_item(p, t._0, hi, t._1, ast::item_ty(ty, tps), attrs);
|
||||||
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, vec[ast::attribute] attrs) -> @ast::item {
|
fn parse_item_tag(&parser p, vec[ast::attribute] attrs) -> @ast::item {
|
||||||
|
@ -1922,10 +1923,7 @@ fn parse_item_tag(&parser p, vec[ast::attribute] attrs) -> @ast::item {
|
||||||
}
|
}
|
||||||
auto hi = p.get_hi_pos();
|
auto hi = p.get_hi_pos();
|
||||||
p.bump();
|
p.bump();
|
||||||
auto item =
|
ret mk_item(p, lo, hi, id, ast::item_tag(variants, ty_params), attrs);
|
||||||
ast::item_tag(id, variants, ty_params, attrs, p.next_def_id(),
|
|
||||||
p.get_ann());
|
|
||||||
ret @spanned(lo, hi, item);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
fn parse_layer(&parser p) -> ast::layer {
|
fn parse_layer(&parser p) -> ast::layer {
|
||||||
|
|
|
@ -63,7 +63,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) {
|
fn visit_item(@ctx cx, &@ast::item i, &scope sc, &vt[scope] v) {
|
||||||
alt (i.node) {
|
alt (i.node) {
|
||||||
case (ast::item_obj(_, ?o, _, _, _, _)) {
|
case (ast::item_obj(?o, _, _)) {
|
||||||
for (ast::obj_field f in o.fields) {
|
for (ast::obj_field f in o.fields) {
|
||||||
cx.local_map.insert(f.id._1, objfield(f.mut));
|
cx.local_map.insert(f.id._1, objfield(f.mut));
|
||||||
}
|
}
|
||||||
|
|
|
@ -361,64 +361,65 @@ fn encode_module_item_paths(&ebml::writer ebml_w, &ast::_mod module,
|
||||||
&vec[str] path,
|
&vec[str] path,
|
||||||
&mutable vec[tup(str, uint)] index) {
|
&mutable vec[tup(str, uint)] index) {
|
||||||
for (@ast::item it in module.items) {
|
for (@ast::item it in module.items) {
|
||||||
if (!ast::is_exported(ast::item_ident(it), module)) { cont; }
|
if (!ast::is_exported(it.ident, module)) { cont; }
|
||||||
alt (it.node) {
|
alt (it.node) {
|
||||||
case (ast::item_const(?id, _, ?tps, _, ?did, ?ann)) {
|
case (ast::item_const(_, _)) {
|
||||||
add_to_index(ebml_w, path, index, id);
|
add_to_index(ebml_w, path, index, it.ident);
|
||||||
ebml::start_tag(ebml_w, tag_paths_data_item);
|
ebml::start_tag(ebml_w, tag_paths_data_item);
|
||||||
encode_name(ebml_w, id);
|
encode_name(ebml_w, it.ident);
|
||||||
encode_def_id(ebml_w, did);
|
encode_def_id(ebml_w, it.id);
|
||||||
ebml::end_tag(ebml_w);
|
ebml::end_tag(ebml_w);
|
||||||
}
|
}
|
||||||
case (ast::item_fn(?id, _, ?tps, _, ?did, ?ann)) {
|
case (ast::item_fn(_, ?tps)) {
|
||||||
add_to_index(ebml_w, path, index, id);
|
add_to_index(ebml_w, path, index, it.ident);
|
||||||
ebml::start_tag(ebml_w, tag_paths_data_item);
|
ebml::start_tag(ebml_w, tag_paths_data_item);
|
||||||
encode_name(ebml_w, id);
|
encode_name(ebml_w, it.ident);
|
||||||
encode_def_id(ebml_w, did);
|
encode_def_id(ebml_w, it.id);
|
||||||
ebml::end_tag(ebml_w);
|
ebml::end_tag(ebml_w);
|
||||||
}
|
}
|
||||||
case (ast::item_mod(?id, ?_mod, _, ?did)) {
|
case (ast::item_mod(?_mod)) {
|
||||||
add_to_index(ebml_w, path, index, id);
|
add_to_index(ebml_w, path, index, it.ident);
|
||||||
ebml::start_tag(ebml_w, tag_paths_data_mod);
|
ebml::start_tag(ebml_w, tag_paths_data_mod);
|
||||||
encode_name(ebml_w, id);
|
encode_name(ebml_w, it.ident);
|
||||||
encode_def_id(ebml_w, did);
|
encode_def_id(ebml_w, it.id);
|
||||||
encode_module_item_paths(ebml_w, _mod, path + [id], index);
|
encode_module_item_paths(ebml_w, _mod, path + [it.ident],
|
||||||
ebml::end_tag(ebml_w);
|
|
||||||
}
|
|
||||||
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);
|
|
||||||
encode_def_id(ebml_w, did);
|
|
||||||
encode_native_module_item_paths(ebml_w, nmod, path + [id],
|
|
||||||
index);
|
index);
|
||||||
ebml::end_tag(ebml_w);
|
ebml::end_tag(ebml_w);
|
||||||
}
|
}
|
||||||
case (ast::item_ty(?id, _, ?tps, _, ?did, ?ann)) {
|
case (ast::item_native_mod(?nmod)) {
|
||||||
add_to_index(ebml_w, path, index, id);
|
add_to_index(ebml_w, path, index, it.ident);
|
||||||
ebml::start_tag(ebml_w, tag_paths_data_item);
|
ebml::start_tag(ebml_w, tag_paths_data_mod);
|
||||||
encode_name(ebml_w, id);
|
encode_name(ebml_w, it.ident);
|
||||||
encode_def_id(ebml_w, did);
|
encode_def_id(ebml_w, it.id);
|
||||||
|
encode_native_module_item_paths(ebml_w, nmod,
|
||||||
|
path + [it.ident], index);
|
||||||
ebml::end_tag(ebml_w);
|
ebml::end_tag(ebml_w);
|
||||||
}
|
}
|
||||||
case (ast::item_tag(?id, ?variants, ?tps, _, ?did, _)) {
|
case (ast::item_ty(_, ?tps)) {
|
||||||
add_to_index(ebml_w, path, index, id);
|
add_to_index(ebml_w, path, index, it.ident);
|
||||||
ebml::start_tag(ebml_w, tag_paths_data_item);
|
ebml::start_tag(ebml_w, tag_paths_data_item);
|
||||||
encode_name(ebml_w, id);
|
encode_name(ebml_w, it.ident);
|
||||||
encode_def_id(ebml_w, did);
|
encode_def_id(ebml_w, it.id);
|
||||||
|
ebml::end_tag(ebml_w);
|
||||||
|
}
|
||||||
|
case (ast::item_tag(?variants, ?tps)) {
|
||||||
|
add_to_index(ebml_w, path, index, it.ident);
|
||||||
|
ebml::start_tag(ebml_w, tag_paths_data_item);
|
||||||
|
encode_name(ebml_w, it.ident);
|
||||||
|
encode_def_id(ebml_w, it.id);
|
||||||
ebml::end_tag(ebml_w);
|
ebml::end_tag(ebml_w);
|
||||||
encode_tag_variant_paths(ebml_w, variants, path, index);
|
encode_tag_variant_paths(ebml_w, variants, path, index);
|
||||||
}
|
}
|
||||||
case (ast::item_obj(?id, _, ?tps, _, ?odid, ?ann)) {
|
case (ast::item_obj(_, ?tps, ?ctor_id)) {
|
||||||
add_to_index(ebml_w, path, index, id);
|
add_to_index(ebml_w, path, index, it.ident);
|
||||||
ebml::start_tag(ebml_w, tag_paths_data_item);
|
ebml::start_tag(ebml_w, tag_paths_data_item);
|
||||||
encode_name(ebml_w, id);
|
encode_name(ebml_w, it.ident);
|
||||||
encode_def_id(ebml_w, odid.ctor);
|
encode_def_id(ebml_w, ctor_id);
|
||||||
ebml::end_tag(ebml_w);
|
ebml::end_tag(ebml_w);
|
||||||
add_to_index(ebml_w, path, index, id);
|
add_to_index(ebml_w, path, index, it.ident);
|
||||||
ebml::start_tag(ebml_w, tag_paths_data_item);
|
ebml::start_tag(ebml_w, tag_paths_data_item);
|
||||||
encode_name(ebml_w, id);
|
encode_name(ebml_w, it.ident);
|
||||||
encode_def_id(ebml_w, odid.ty);
|
encode_def_id(ebml_w, it.id);
|
||||||
ebml::end_tag(ebml_w);
|
ebml::end_tag(ebml_w);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -509,67 +510,68 @@ 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,
|
fn encode_info_for_item(@trans::crate_ctxt cx, &ebml::writer ebml_w,
|
||||||
@ast::item item, &mutable vec[tup(int, uint)] index) {
|
@ast::item item, &mutable vec[tup(int, uint)] index) {
|
||||||
alt (item.node) {
|
alt (item.node) {
|
||||||
case (ast::item_const(_, _, _, _, ?did, ?ann)) {
|
case (ast::item_const(_, _)) {
|
||||||
ebml::start_tag(ebml_w, tag_items_data_item);
|
ebml::start_tag(ebml_w, tag_items_data_item);
|
||||||
encode_def_id(ebml_w, did);
|
encode_def_id(ebml_w, item.id);
|
||||||
encode_kind(ebml_w, 'c' as u8);
|
encode_kind(ebml_w, 'c' as u8);
|
||||||
encode_type(cx, ebml_w, trans::node_ann_type(cx, ann));
|
encode_type(cx, ebml_w, trans::node_ann_type(cx, item.ann));
|
||||||
encode_symbol(cx, ebml_w, did);
|
encode_symbol(cx, ebml_w, item.id);
|
||||||
ebml::end_tag(ebml_w);
|
ebml::end_tag(ebml_w);
|
||||||
}
|
}
|
||||||
case (ast::item_fn(_, _, ?tps, _, ?did, ?ann)) {
|
case (ast::item_fn(_, ?tps)) {
|
||||||
ebml::start_tag(ebml_w, tag_items_data_item);
|
ebml::start_tag(ebml_w, tag_items_data_item);
|
||||||
encode_def_id(ebml_w, did);
|
encode_def_id(ebml_w, item.id);
|
||||||
encode_kind(ebml_w, 'f' as u8);
|
encode_kind(ebml_w, 'f' as u8);
|
||||||
encode_type_param_count(ebml_w, tps);
|
encode_type_param_count(ebml_w, tps);
|
||||||
encode_type(cx, ebml_w, trans::node_ann_type(cx, ann));
|
encode_type(cx, ebml_w, trans::node_ann_type(cx, item.ann));
|
||||||
encode_symbol(cx, ebml_w, did);
|
encode_symbol(cx, ebml_w, item.id);
|
||||||
ebml::end_tag(ebml_w);
|
ebml::end_tag(ebml_w);
|
||||||
}
|
}
|
||||||
case (ast::item_mod(_, _, _, ?did)) {
|
case (ast::item_mod(_)) {
|
||||||
ebml::start_tag(ebml_w, tag_items_data_item);
|
ebml::start_tag(ebml_w, tag_items_data_item);
|
||||||
encode_def_id(ebml_w, did);
|
encode_def_id(ebml_w, item.id);
|
||||||
encode_kind(ebml_w, 'm' as u8);
|
encode_kind(ebml_w, 'm' as u8);
|
||||||
ebml::end_tag(ebml_w);
|
ebml::end_tag(ebml_w);
|
||||||
}
|
}
|
||||||
case (ast::item_native_mod(?id, _, _, ?did)) {
|
case (ast::item_native_mod(_)) {
|
||||||
ebml::start_tag(ebml_w, tag_items_data_item);
|
ebml::start_tag(ebml_w, tag_items_data_item);
|
||||||
encode_def_id(ebml_w, did);
|
encode_def_id(ebml_w, item.id);
|
||||||
encode_kind(ebml_w, 'n' as u8);
|
encode_kind(ebml_w, 'n' as u8);
|
||||||
ebml::end_tag(ebml_w);
|
ebml::end_tag(ebml_w);
|
||||||
}
|
}
|
||||||
case (ast::item_ty(?id, _, ?tps, _, ?did, ?ann)) {
|
case (ast::item_ty(_, ?tps)) {
|
||||||
ebml::start_tag(ebml_w, tag_items_data_item);
|
ebml::start_tag(ebml_w, tag_items_data_item);
|
||||||
encode_def_id(ebml_w, did);
|
encode_def_id(ebml_w, item.id);
|
||||||
encode_kind(ebml_w, 'y' as u8);
|
encode_kind(ebml_w, 'y' as u8);
|
||||||
encode_type_param_count(ebml_w, tps);
|
encode_type_param_count(ebml_w, tps);
|
||||||
encode_type(cx, ebml_w, trans::node_ann_type(cx, ann));
|
encode_type(cx, ebml_w, trans::node_ann_type(cx, item.ann));
|
||||||
ebml::end_tag(ebml_w);
|
ebml::end_tag(ebml_w);
|
||||||
}
|
}
|
||||||
case (ast::item_tag(?id, ?variants, ?tps, _, ?did, ?ann)) {
|
case (ast::item_tag(?variants, ?tps)) {
|
||||||
ebml::start_tag(ebml_w, tag_items_data_item);
|
ebml::start_tag(ebml_w, tag_items_data_item);
|
||||||
encode_def_id(ebml_w, did);
|
encode_def_id(ebml_w, item.id);
|
||||||
encode_kind(ebml_w, 't' as u8);
|
encode_kind(ebml_w, 't' as u8);
|
||||||
encode_type_param_count(ebml_w, tps);
|
encode_type_param_count(ebml_w, tps);
|
||||||
encode_type(cx, ebml_w, trans::node_ann_type(cx, ann));
|
encode_type(cx, ebml_w, trans::node_ann_type(cx, item.ann));
|
||||||
for (ast::variant v in variants) {
|
for (ast::variant v in variants) {
|
||||||
encode_variant_id(ebml_w, v.node.id);
|
encode_variant_id(ebml_w, v.node.id);
|
||||||
}
|
}
|
||||||
ebml::end_tag(ebml_w);
|
ebml::end_tag(ebml_w);
|
||||||
encode_tag_variant_info(cx, ebml_w, did, variants, index, tps);
|
encode_tag_variant_info(cx, ebml_w, item.id, variants,
|
||||||
|
index, tps);
|
||||||
}
|
}
|
||||||
case (ast::item_obj(?id, _, ?tps, _, ?odid, ?ann)) {
|
case (ast::item_obj(_, ?tps, ?ctor_id)) {
|
||||||
ebml::start_tag(ebml_w, tag_items_data_item);
|
ebml::start_tag(ebml_w, tag_items_data_item);
|
||||||
encode_def_id(ebml_w, odid.ctor);
|
encode_def_id(ebml_w, ctor_id);
|
||||||
encode_kind(ebml_w, 'o' as u8);
|
encode_kind(ebml_w, 'o' as u8);
|
||||||
encode_type_param_count(ebml_w, tps);
|
encode_type_param_count(ebml_w, tps);
|
||||||
auto fn_ty = trans::node_ann_type(cx, ann);
|
auto fn_ty = trans::node_ann_type(cx, item.ann);
|
||||||
encode_type(cx, ebml_w, fn_ty);
|
encode_type(cx, ebml_w, fn_ty);
|
||||||
encode_symbol(cx, ebml_w, odid.ctor);
|
encode_symbol(cx, ebml_w, ctor_id);
|
||||||
ebml::end_tag(ebml_w);
|
ebml::end_tag(ebml_w);
|
||||||
index += [tup(odid.ty._1, ebml_w.writer.tell())];
|
index += [tup(item.id._1, ebml_w.writer.tell())];
|
||||||
ebml::start_tag(ebml_w, tag_items_data_item);
|
ebml::start_tag(ebml_w, tag_items_data_item);
|
||||||
encode_def_id(ebml_w, odid.ty);
|
encode_def_id(ebml_w, item.id);
|
||||||
encode_kind(ebml_w, 'y' as u8);
|
encode_kind(ebml_w, 'y' as u8);
|
||||||
encode_type_param_count(ebml_w, tps);
|
encode_type_param_count(ebml_w, tps);
|
||||||
encode_type(cx, ebml_w, ty::ty_fn_ret(cx.tcx, fn_ty));
|
encode_type(cx, ebml_w, ty::ty_fn_ret(cx.tcx, fn_ty));
|
||||||
|
|
|
@ -176,39 +176,30 @@ fn map_crate(&@env e, &@ast::crate c) {
|
||||||
fn index_i(@env e, &@ast::item i, &scopes sc, &vt[scopes] v) {
|
fn index_i(@env e, &@ast::item i, &scopes sc, &vt[scopes] v) {
|
||||||
visit_item_with_scope(i, sc, v);
|
visit_item_with_scope(i, sc, v);
|
||||||
alt (i.node) {
|
alt (i.node) {
|
||||||
case (ast::item_mod(_, ?md, _, ?defid)) {
|
case (ast::item_mod(?md)) {
|
||||||
auto s = new_str_hash[import_state]();
|
auto s = new_str_hash[import_state]();
|
||||||
e.mod_map.insert(defid._1,
|
e.mod_map.insert(i.id._1,
|
||||||
@rec(m=some(md),
|
@rec(m=some(md),
|
||||||
index=index_mod(md),
|
index=index_mod(md),
|
||||||
mutable glob_imports=vec::empty[def](),
|
mutable glob_imports=vec::empty[def](),
|
||||||
glob_imported_names=s));
|
glob_imported_names=s));
|
||||||
e.ast_map.insert(defid, i);
|
e.ast_map.insert(i.id, i);
|
||||||
}
|
}
|
||||||
case (ast::item_native_mod(_, ?nmd, _, ?defid)) {
|
case (ast::item_native_mod(?nmd)) {
|
||||||
auto s = new_str_hash[import_state]();
|
auto s = new_str_hash[import_state]();
|
||||||
e.mod_map.insert(defid._1,
|
e.mod_map.insert(i.id._1,
|
||||||
@rec(m=none[ast::_mod],
|
@rec(m=none[ast::_mod],
|
||||||
index=index_nmod(nmd),
|
index=index_nmod(nmd),
|
||||||
mutable glob_imports=vec::empty[def](),
|
mutable glob_imports=vec::empty[def](),
|
||||||
glob_imported_names=s));
|
glob_imported_names=s));
|
||||||
e.ast_map.insert(defid, i);
|
e.ast_map.insert(i.id, i);
|
||||||
}
|
}
|
||||||
case (ast::item_const(_, _, _, _, ?defid, _)) {
|
case (ast::item_obj(_, _, ?ctor_id)) {
|
||||||
e.ast_map.insert(defid, i);
|
e.ast_map.insert(i.id, i);
|
||||||
|
e.ast_map.insert(ctor_id, i);
|
||||||
}
|
}
|
||||||
case (ast::item_fn(_, _, _, _, ?defid, _)) {
|
case (_) {
|
||||||
e.ast_map.insert(defid, i);
|
e.ast_map.insert(i.id, i);
|
||||||
}
|
|
||||||
case (ast::item_ty(_, _, _, _, ?defid, _)) {
|
|
||||||
e.ast_map.insert(defid, i);
|
|
||||||
}
|
|
||||||
case (ast::item_tag(_, _, _, _, ?defid, _)) {
|
|
||||||
e.ast_map.insert(defid, i);
|
|
||||||
}
|
|
||||||
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);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -225,11 +216,11 @@ fn map_crate(&@env e, &@ast::crate c) {
|
||||||
alt (sc) {
|
alt (sc) {
|
||||||
case (cons(scope_item(?i), ?tl)) {
|
case (cons(scope_item(?i), ?tl)) {
|
||||||
alt (i.node) {
|
alt (i.node) {
|
||||||
case (ast::item_mod(_, _, _, ?defid)) {
|
case (ast::item_mod(_)) {
|
||||||
ret e.mod_map.get(defid._1);
|
ret e.mod_map.get(i.id._1);
|
||||||
}
|
}
|
||||||
case (ast::item_native_mod(_, _, _, ?defid)) {
|
case (ast::item_native_mod(_)) {
|
||||||
ret e.mod_map.get(defid._1);
|
ret e.mod_map.get(i.id._1);
|
||||||
}
|
}
|
||||||
case (_) { be find_mod(e, *tl); }
|
case (_) { be find_mod(e, *tl); }
|
||||||
}
|
}
|
||||||
|
@ -556,21 +547,21 @@ fn lookup_in_scope(&env e, scopes sc, &span sp, &ident id, namespace ns) ->
|
||||||
}
|
}
|
||||||
case (scope_item(?it)) {
|
case (scope_item(?it)) {
|
||||||
alt (it.node) {
|
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);
|
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) {
|
if (ns == ns_type) {
|
||||||
ret lookup_in_ty_params(id, ty_params);
|
ret lookup_in_ty_params(id, ty_params);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
case (ast::item_mod(_, _, _, ?defid)) {
|
case (ast::item_mod(_)) {
|
||||||
ret lookup_in_local_mod(e, defid, sp, id, ns, inside);
|
ret lookup_in_local_mod(e, it.id, sp, id, ns, inside);
|
||||||
}
|
}
|
||||||
case (ast::item_native_mod(_, ?m, _, ?defid)) {
|
case (ast::item_native_mod(?m)) {
|
||||||
ret lookup_in_local_native_mod(e, defid, sp, id, ns);
|
ret lookup_in_local_native_mod(e, it.id, sp, id, ns);
|
||||||
}
|
}
|
||||||
case (ast::item_ty(_, _, ?ty_params, _, _, _)) {
|
case (ast::item_ty(_, ?ty_params)) {
|
||||||
if (ns == ns_type) {
|
if (ns == ns_type) {
|
||||||
ret lookup_in_ty_params(id, ty_params);
|
ret lookup_in_ty_params(id, ty_params);
|
||||||
}
|
}
|
||||||
|
@ -702,24 +693,23 @@ fn lookup_in_block(&ident id, &ast::block_ b, namespace ns) ->
|
||||||
}
|
}
|
||||||
case (ast::decl_item(?it)) {
|
case (ast::decl_item(?it)) {
|
||||||
alt (it.node) {
|
alt (it.node) {
|
||||||
case (ast::item_tag(?name, ?variants, _, _,
|
case (ast::item_tag(?variants, _)) {
|
||||||
?defid, _)) {
|
|
||||||
if (ns == ns_type) {
|
if (ns == ns_type) {
|
||||||
if (str::eq(name, id)) {
|
if (str::eq(it.ident, id)) {
|
||||||
ret some(ast::def_ty(defid));
|
ret some(ast::def_ty(it.id));
|
||||||
}
|
}
|
||||||
} else if (ns == ns_value) {
|
} else if (ns == ns_value) {
|
||||||
for (ast::variant v in variants) {
|
for (ast::variant v in variants) {
|
||||||
if (str::eq(v.node.name, id)) {
|
if (str::eq(v.node.name, id)) {
|
||||||
auto i = v.node.id;
|
auto i = v.node.id;
|
||||||
ret some(ast::def_variant(defid,
|
ret some(ast::def_variant(it.id,
|
||||||
i));
|
i));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
case (_) {
|
case (_) {
|
||||||
if (str::eq(ast::item_ident(it), id)) {
|
if (str::eq(it.ident, id)) {
|
||||||
auto found = found_def_item(it, ns);
|
auto found = found_def_item(it, ns);
|
||||||
if (!option::is_none(found)) {
|
if (!option::is_none(found)) {
|
||||||
ret found;
|
ret found;
|
||||||
|
@ -738,28 +728,28 @@ fn lookup_in_block(&ident id, &ast::block_ b, namespace ns) ->
|
||||||
|
|
||||||
fn found_def_item(&@ast::item i, namespace ns) -> option::t[def] {
|
fn found_def_item(&@ast::item i, namespace ns) -> option::t[def] {
|
||||||
alt (i.node) {
|
alt (i.node) {
|
||||||
case (ast::item_const(_, _, _, _, ?defid, _)) {
|
case (ast::item_const(_, _)) {
|
||||||
if (ns == ns_value) { ret some(ast::def_const(defid)); }
|
if (ns == ns_value) { ret some(ast::def_const(i.id)); }
|
||||||
}
|
}
|
||||||
case (ast::item_fn(_, _, _, _, ?defid, _)) {
|
case (ast::item_fn(_, _)) {
|
||||||
if (ns == ns_value) { ret some(ast::def_fn(defid)); }
|
if (ns == ns_value) { ret some(ast::def_fn(i.id)); }
|
||||||
}
|
}
|
||||||
case (ast::item_mod(_, _, _, ?defid)) {
|
case (ast::item_mod(_)) {
|
||||||
if (ns == ns_module) { ret some(ast::def_mod(defid)); }
|
if (ns == ns_module) { ret some(ast::def_mod(i.id)); }
|
||||||
}
|
}
|
||||||
case (ast::item_native_mod(_, _, _, ?defid)) {
|
case (ast::item_native_mod(_)) {
|
||||||
if (ns == ns_module) { ret some(ast::def_native_mod(defid)); }
|
if (ns == ns_module) { ret some(ast::def_native_mod(i.id)); }
|
||||||
}
|
}
|
||||||
case (ast::item_ty(_, _, _, _, ?defid, _)) {
|
case (ast::item_ty(_, _)) {
|
||||||
if (ns == ns_type) { ret some(ast::def_ty(defid)); }
|
if (ns == ns_type) { ret some(ast::def_ty(i.id)); }
|
||||||
}
|
}
|
||||||
case (ast::item_tag(_, _, _, _, ?defid, _)) {
|
case (ast::item_tag(_, _)) {
|
||||||
if (ns == ns_type) { ret some(ast::def_ty(defid)); }
|
if (ns == ns_type) { ret some(ast::def_ty(i.id)); }
|
||||||
}
|
}
|
||||||
case (ast::item_obj(_, _, _, _, ?odid, _)) {
|
case (ast::item_obj(_, _, ?ctor_id)) {
|
||||||
alt (ns) {
|
alt (ns) {
|
||||||
case (ns_value) { ret some(ast::def_obj(odid.ctor)); }
|
case (ns_value) { ret some(ast::def_obj(ctor_id)); }
|
||||||
case (ns_type) { ret some(ast::def_obj(odid.ty)); }
|
case (ns_type) { ret some(ast::def_obj(i.id)); }
|
||||||
case (_) { }
|
case (_) { }
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -939,10 +929,10 @@ fn lookup_in_mie(&env e, &mod_index_entry mie, namespace ns) ->
|
||||||
case (mie_item(?item)) { ret found_def_item(item, ns); }
|
case (mie_item(?item)) { ret found_def_item(item, ns); }
|
||||||
case (mie_tag_variant(?item, ?variant_idx)) {
|
case (mie_tag_variant(?item, ?variant_idx)) {
|
||||||
alt (item.node) {
|
alt (item.node) {
|
||||||
case (ast::item_tag(_, ?variants, _, _, ?tid, _)) {
|
case (ast::item_tag(?variants, _)) {
|
||||||
if (ns == ns_value) {
|
if (ns == ns_value) {
|
||||||
auto vid = variants.(variant_idx).node.id;
|
auto vid = variants.(variant_idx).node.id;
|
||||||
ret some(ast::def_variant(tid, vid));
|
ret some(ast::def_variant(item.id, vid));
|
||||||
} else { ret none[def]; }
|
} else { ret none[def]; }
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -991,23 +981,23 @@ fn index_mod(&ast::_mod md) -> mod_index {
|
||||||
}
|
}
|
||||||
for (@ast::item it in md.items) {
|
for (@ast::item it in md.items) {
|
||||||
alt (it.node) {
|
alt (it.node) {
|
||||||
case (ast::item_const(?id, _, _, _, _, _)) {
|
case (ast::item_const(_, _)) {
|
||||||
add_to_index(index, id, mie_item(it));
|
add_to_index(index, it.ident, mie_item(it));
|
||||||
}
|
}
|
||||||
case (ast::item_fn(?id, _, _, _, _, _)) {
|
case (ast::item_fn(_, _)) {
|
||||||
add_to_index(index, id, mie_item(it));
|
add_to_index(index, it.ident, mie_item(it));
|
||||||
}
|
}
|
||||||
case (ast::item_mod(?id, _, _, _)) {
|
case (ast::item_mod(_)) {
|
||||||
add_to_index(index, id, mie_item(it));
|
add_to_index(index, it.ident, mie_item(it));
|
||||||
}
|
}
|
||||||
case (ast::item_native_mod(?id, _, _, _)) {
|
case (ast::item_native_mod(_)) {
|
||||||
add_to_index(index, id, mie_item(it));
|
add_to_index(index, it.ident, mie_item(it));
|
||||||
}
|
}
|
||||||
case (ast::item_ty(?id, _, _, _, _, _)) {
|
case (ast::item_ty(_, _)) {
|
||||||
add_to_index(index, id, mie_item(it));
|
add_to_index(index, it.ident, mie_item(it));
|
||||||
}
|
}
|
||||||
case (ast::item_tag(?id, ?variants, _, _, _, _)) {
|
case (ast::item_tag(?variants, _)) {
|
||||||
add_to_index(index, id, mie_item(it));
|
add_to_index(index, it.ident, mie_item(it));
|
||||||
let uint variant_idx = 0u;
|
let uint variant_idx = 0u;
|
||||||
for (ast::variant v in variants) {
|
for (ast::variant v in variants) {
|
||||||
add_to_index(index, v.node.name,
|
add_to_index(index, v.node.name,
|
||||||
|
@ -1015,8 +1005,8 @@ fn index_mod(&ast::_mod md) -> mod_index {
|
||||||
variant_idx += 1u;
|
variant_idx += 1u;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
case (ast::item_obj(?id, _, _, _, _, _)) {
|
case (ast::item_obj(_, _, _)) {
|
||||||
add_to_index(index, id, mie_item(it));
|
add_to_index(index, it.ident, mie_item(it));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1143,11 +1133,11 @@ fn mie_span(&mod_index_entry mie) -> span {
|
||||||
fn check_item(@env e, &@ast::item i, &() x, &vt[()] v) {
|
fn check_item(@env e, &@ast::item i, &() x, &vt[()] v) {
|
||||||
visit::visit_item(i, x, v);
|
visit::visit_item(i, x, v);
|
||||||
alt (i.node) {
|
alt (i.node) {
|
||||||
case (ast::item_fn(_, ?f, ?ty_params, _, _, _)) {
|
case (ast::item_fn(?f, ?ty_params)) {
|
||||||
check_fn(*e, i.span, f);
|
check_fn(*e, i.span, f);
|
||||||
ensure_unique(*e, i.span, ty_params, ident_id, "type parameter");
|
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; }
|
fn field_name(&ast::obj_field field) -> ident { ret field.ident; }
|
||||||
ensure_unique(*e, i.span, ob.fields, field_name, "object field");
|
ensure_unique(*e, i.span, ob.fields, field_name, "object field");
|
||||||
for (@ast::method m in ob.methods) {
|
for (@ast::method m in ob.methods) {
|
||||||
|
@ -1155,7 +1145,7 @@ fn check_item(@env e, &@ast::item i, &() x, &vt[()] v) {
|
||||||
}
|
}
|
||||||
ensure_unique(*e, i.span, ty_params, ident_id, "type parameter");
|
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");
|
ensure_unique(*e, i.span, ty_params, ident_id, "type parameter");
|
||||||
}
|
}
|
||||||
case (_) { }
|
case (_) { }
|
||||||
|
@ -1190,31 +1180,30 @@ fn check_block(@env e, &ast::block b, &() x, &vt[()] v) {
|
||||||
}
|
}
|
||||||
case (ast::decl_item(?it)) {
|
case (ast::decl_item(?it)) {
|
||||||
alt (it.node) {
|
alt (it.node) {
|
||||||
case (ast::item_tag(?name, ?variants, _, _, _, _))
|
case (ast::item_tag(?variants, _)) {
|
||||||
{
|
add_name(types, it.span, it.ident);
|
||||||
add_name(types, it.span, name);
|
|
||||||
for (ast::variant v in variants) {
|
for (ast::variant v in variants) {
|
||||||
add_name(values, v.span, v.node.name);
|
add_name(values, v.span, v.node.name);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
case (ast::item_const(?name, _, _, _, _, _)) {
|
case (ast::item_const(_, _)) {
|
||||||
add_name(values, it.span, name);
|
add_name(values, it.span, it.ident);
|
||||||
}
|
}
|
||||||
case (ast::item_fn(?name, _, _, _, _, _)) {
|
case (ast::item_fn(_, _)) {
|
||||||
add_name(values, it.span, name);
|
add_name(values, it.span, it.ident);
|
||||||
}
|
}
|
||||||
case (ast::item_mod(?name, _, _, _)) {
|
case (ast::item_mod(_)) {
|
||||||
add_name(mods, it.span, name);
|
add_name(mods, it.span, it.ident);
|
||||||
}
|
}
|
||||||
case (ast::item_native_mod(?name, _, _, _)) {
|
case (ast::item_native_mod(_)) {
|
||||||
add_name(mods, it.span, name);
|
add_name(mods, it.span, it.ident);
|
||||||
}
|
}
|
||||||
case (ast::item_ty(?name, _, _, _, _, _)) {
|
case (ast::item_ty(_, _)) {
|
||||||
add_name(types, it.span, name);
|
add_name(types, it.span, it.ident);
|
||||||
}
|
}
|
||||||
case (ast::item_obj(?name, _, _, _, _, _)) {
|
case (ast::item_obj(_, _, _)) {
|
||||||
add_name(types, it.span, name);
|
add_name(types, it.span, it.ident);
|
||||||
add_name(values, it.span, name);
|
add_name(values, it.span, it.ident);
|
||||||
}
|
}
|
||||||
case (_) { }
|
case (_) { }
|
||||||
}
|
}
|
||||||
|
|
|
@ -7254,34 +7254,34 @@ fn trans_const(&@crate_ctxt cx, @ast::expr e, &ast::def_id cid,
|
||||||
|
|
||||||
fn trans_item(@local_ctxt cx, &ast::item item) {
|
fn trans_item(@local_ctxt cx, &ast::item item) {
|
||||||
alt (item.node) {
|
alt (item.node) {
|
||||||
case (ast::item_fn(?name, ?f, ?tps, _, ?fid, ?ann)) {
|
case (ast::item_fn(?f, ?tps)) {
|
||||||
auto sub_cx = extend_path(cx, name);
|
auto sub_cx = extend_path(cx, item.ident);
|
||||||
auto llfndecl = cx.ccx.item_ids.get(fid);
|
auto llfndecl = cx.ccx.item_ids.get(item.id);
|
||||||
trans_fn(sub_cx, item.span, f, llfndecl, none[ty_self_pair], tps,
|
trans_fn(sub_cx, item.span, f, llfndecl, none[ty_self_pair], tps,
|
||||||
ann);
|
item.ann);
|
||||||
}
|
}
|
||||||
case (ast::item_obj(?name, ?ob, ?tps, _, ?oid, ?ann)) {
|
case (ast::item_obj(?ob, ?tps, ?ctor_id)) {
|
||||||
auto sub_cx =
|
auto sub_cx =
|
||||||
@rec(obj_typarams=tps, obj_fields=ob.fields
|
@rec(obj_typarams=tps, obj_fields=ob.fields
|
||||||
with *extend_path(cx, name));
|
with *extend_path(cx, item.ident));
|
||||||
trans_obj(sub_cx, item.span, ob, oid.ctor, tps, ann);
|
trans_obj(sub_cx, item.span, ob, ctor_id, tps, item.ann);
|
||||||
}
|
}
|
||||||
case (ast::item_mod(?name, ?m, _, _)) {
|
case (ast::item_mod(?m)) {
|
||||||
auto sub_cx =
|
auto sub_cx =
|
||||||
@rec(path=cx.path + [name],
|
@rec(path=cx.path + [item.ident],
|
||||||
module_path=cx.module_path + [name] with *cx);
|
module_path=cx.module_path + [item.ident] with *cx);
|
||||||
trans_mod(sub_cx, m);
|
trans_mod(sub_cx, m);
|
||||||
}
|
}
|
||||||
case (ast::item_tag(?name, ?variants, ?tps, _, ?tag_id, _)) {
|
case (ast::item_tag(?variants, ?tps)) {
|
||||||
auto sub_cx = extend_path(cx, name);
|
auto sub_cx = extend_path(cx, item.ident);
|
||||||
auto i = 0;
|
auto i = 0;
|
||||||
for (ast::variant variant in variants) {
|
for (ast::variant variant in variants) {
|
||||||
trans_tag_variant(sub_cx, tag_id, variant, i, tps);
|
trans_tag_variant(sub_cx, item.id, variant, i, tps);
|
||||||
i += 1;
|
i += 1;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
case (ast::item_const(?name, _, ?expr, _, ?cid, ?ann)) {
|
case (ast::item_const(_, ?expr)) {
|
||||||
trans_const(cx.ccx, expr, cid, ann);
|
trans_const(cx.ccx, expr, item.id, item.ann);
|
||||||
}
|
}
|
||||||
case (_) {/* fall through */ }
|
case (_) {/* fall through */ }
|
||||||
}
|
}
|
||||||
|
@ -7545,12 +7545,7 @@ fn decl_native_fn_and_pair(&@crate_ctxt ccx, &span sp, vec[str] path,
|
||||||
}
|
}
|
||||||
|
|
||||||
fn item_path(&@ast::item item) -> vec[str] {
|
fn item_path(&@ast::item item) -> vec[str] {
|
||||||
alt (item.node) {
|
ret [item.ident];
|
||||||
case (ast::item_fn(?name, _, _, _, _, _)) { ret [name]; }
|
|
||||||
case (ast::item_obj(?name, _, _, _, _, _)) { ret [name]; }
|
|
||||||
case (ast::item_mod(?name, _, _, _)) { ret [name]; }
|
|
||||||
case (_) { ret []; }
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
fn collect_native_item(@crate_ctxt ccx, &@ast::native_item i, &vec[str] pt,
|
fn collect_native_item(@crate_ctxt ccx, &@ast::native_item i, &vec[str] pt,
|
||||||
|
@ -7572,25 +7567,21 @@ fn collect_item_1(@crate_ctxt ccx, &@ast::item i, &vec[str] pt,
|
||||||
&vt[vec[str]] v) {
|
&vt[vec[str]] v) {
|
||||||
visit::visit_item(i, pt + item_path(i), v);
|
visit::visit_item(i, pt + item_path(i), v);
|
||||||
alt (i.node) {
|
alt (i.node) {
|
||||||
case (ast::item_const(?name, _, _, _, ?cid, ?ann)) {
|
case (ast::item_const(_, _)) {
|
||||||
auto typ = node_ann_type(ccx, ann);
|
auto typ = node_ann_type(ccx, i.ann);
|
||||||
auto g =
|
auto g =
|
||||||
llvm::LLVMAddGlobal(ccx.llmod, type_of(ccx, i.span, typ),
|
llvm::LLVMAddGlobal(ccx.llmod, type_of(ccx, i.span, typ),
|
||||||
str::buf(ccx.names.next(name)));
|
str::buf(ccx.names.next(i.ident)));
|
||||||
llvm::LLVMSetLinkage(g,
|
llvm::LLVMSetLinkage(g,
|
||||||
lib::llvm::LLVMInternalLinkage as
|
lib::llvm::LLVMInternalLinkage as
|
||||||
llvm::Linkage);
|
llvm::Linkage);
|
||||||
ccx.items.insert(cid, i);
|
ccx.items.insert(i.id, i);
|
||||||
ccx.consts.insert(cid, g);
|
ccx.consts.insert(i.id, g);
|
||||||
}
|
|
||||||
case (ast::item_mod(?name, ?m, _, ?mid)) { ccx.items.insert(mid, i); }
|
|
||||||
case (ast::item_native_mod(_, _, _, ?mid)) {
|
|
||||||
ccx.items.insert(mid, i);
|
|
||||||
}
|
|
||||||
case (ast::item_ty(_, _, _, _, ?did, _)) { ccx.items.insert(did, i); }
|
|
||||||
case (ast::item_tag(?name, ?variants, ?tps, _, ?tag_id, _)) {
|
|
||||||
ccx.items.insert(tag_id, i);
|
|
||||||
}
|
}
|
||||||
|
case (ast::item_mod(?m)) { ccx.items.insert(i.id, i); }
|
||||||
|
case (ast::item_native_mod(_)) { ccx.items.insert(i.id, i); }
|
||||||
|
case (ast::item_ty(_, _)) { ccx.items.insert(i.id, i); }
|
||||||
|
case (ast::item_tag(_, _)) { ccx.items.insert(i.id, i); }
|
||||||
case (_) { }
|
case (_) { }
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -7600,16 +7591,16 @@ fn collect_item_2(&@crate_ctxt ccx, &@ast::item i, &vec[str] pt,
|
||||||
auto new_pt = pt + item_path(i);
|
auto new_pt = pt + item_path(i);
|
||||||
visit::visit_item(i, new_pt, v);
|
visit::visit_item(i, new_pt, v);
|
||||||
alt (i.node) {
|
alt (i.node) {
|
||||||
case (ast::item_fn(?name, ?f, ?tps, _, ?fid, ?ann)) {
|
case (ast::item_fn(?f, ?tps)) {
|
||||||
ccx.items.insert(fid, i);
|
ccx.items.insert(i.id, i);
|
||||||
if (!ccx.obj_methods.contains_key(fid)) {
|
if (!ccx.obj_methods.contains_key(i.id)) {
|
||||||
decl_fn_and_pair(ccx, i.span, new_pt, "fn", tps, ann, fid);
|
decl_fn_and_pair(ccx, i.span, new_pt, "fn", tps, i.ann, i.id);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
case (ast::item_obj(?name, ?ob, ?tps, _, ?oid, ?ann)) {
|
case (ast::item_obj(?ob, ?tps, ?ctor_id)) {
|
||||||
ccx.items.insert(oid.ctor, i);
|
ccx.items.insert(ctor_id, i);
|
||||||
decl_fn_and_pair(ccx, i.span, new_pt, "obj_ctor", tps, ann,
|
decl_fn_and_pair(ccx, i.span, new_pt, "obj_ctor", tps, i.ann,
|
||||||
oid.ctor);
|
ctor_id);
|
||||||
for (@ast::method m in ob.methods) {
|
for (@ast::method m in ob.methods) {
|
||||||
ccx.obj_methods.insert(m.node.id, ());
|
ccx.obj_methods.insert(m.node.id, ());
|
||||||
}
|
}
|
||||||
|
@ -7634,7 +7625,7 @@ fn collect_tag_ctor(@crate_ctxt ccx, &@ast::item i, &vec[str] pt,
|
||||||
auto new_pt = pt + item_path(i);
|
auto new_pt = pt + item_path(i);
|
||||||
visit::visit_item(i, new_pt, v);
|
visit::visit_item(i, new_pt, v);
|
||||||
alt (i.node) {
|
alt (i.node) {
|
||||||
case (ast::item_tag(_, ?variants, ?tps, _, _, _)) {
|
case (ast::item_tag(?variants, ?tps)) {
|
||||||
for (ast::variant variant in variants) {
|
for (ast::variant variant in variants) {
|
||||||
if (vec::len[ast::variant_arg](variant.node.args) != 0u) {
|
if (vec::len[ast::variant_arg](variant.node.args) != 0u) {
|
||||||
decl_fn_and_pair(ccx, i.span,
|
decl_fn_and_pair(ccx, i.span,
|
||||||
|
@ -7661,13 +7652,13 @@ fn trans_constant(@crate_ctxt ccx, &@ast::item it, &vec[str] pt,
|
||||||
auto new_pt = pt + item_path(it);
|
auto new_pt = pt + item_path(it);
|
||||||
visit::visit_item(it, new_pt, v);
|
visit::visit_item(it, new_pt, v);
|
||||||
alt (it.node) {
|
alt (it.node) {
|
||||||
case (ast::item_tag(?ident, ?variants, _, _, ?tag_id, _)) {
|
case (ast::item_tag(?variants, _)) {
|
||||||
auto i = 0u;
|
auto i = 0u;
|
||||||
auto n_variants = vec::len[ast::variant](variants);
|
auto n_variants = vec::len[ast::variant](variants);
|
||||||
while (i < n_variants) {
|
while (i < n_variants) {
|
||||||
auto variant = variants.(i);
|
auto variant = variants.(i);
|
||||||
auto discrim_val = C_int(i as int);
|
auto discrim_val = C_int(i as int);
|
||||||
auto p = new_pt + [ident, variant.node.name, "discrim"];
|
auto p = new_pt + [it.ident, variant.node.name, "discrim"];
|
||||||
auto s = mangle_exported_name(ccx, p, ty::mk_int(ccx.tcx));
|
auto s = mangle_exported_name(ccx, p, ty::mk_int(ccx.tcx));
|
||||||
auto discrim_gvar =
|
auto discrim_gvar =
|
||||||
llvm::LLVMAddGlobal(ccx.llmod, T_int(), str::buf(s));
|
llvm::LLVMAddGlobal(ccx.llmod, T_int(), str::buf(s));
|
||||||
|
@ -7678,16 +7669,16 @@ fn trans_constant(@crate_ctxt ccx, &@ast::item it, &vec[str] pt,
|
||||||
i += 1u;
|
i += 1u;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
case (ast::item_const(?name, _, ?expr, _, ?cid, ?ann)) {
|
case (ast::item_const(_, ?expr)) {
|
||||||
// FIXME: The whole expr-translation system needs cloning to deal
|
// FIXME: The whole expr-translation system needs cloning to deal
|
||||||
// with consts.
|
// with consts.
|
||||||
|
|
||||||
auto v = C_int(1);
|
auto v = C_int(1);
|
||||||
ccx.item_ids.insert(cid, v);
|
ccx.item_ids.insert(it.id, v);
|
||||||
auto s =
|
auto s =
|
||||||
mangle_exported_name(ccx, new_pt + [name],
|
mangle_exported_name(ccx, new_pt + [it.ident],
|
||||||
node_ann_type(ccx, ann));
|
node_ann_type(ccx, it.ann));
|
||||||
ccx.item_symbols.insert(cid, s);
|
ccx.item_symbols.insert(it.id, s);
|
||||||
}
|
}
|
||||||
case (_) { }
|
case (_) { }
|
||||||
}
|
}
|
||||||
|
|
|
@ -61,7 +61,6 @@ import bitvectors::gen;
|
||||||
import front::ast::*;
|
import front::ast::*;
|
||||||
import middle::ty::expr_ann;
|
import middle::ty::expr_ann;
|
||||||
import util::common::new_def_hash;
|
import util::common::new_def_hash;
|
||||||
import util::common::decl_lhs;
|
|
||||||
import util::common::uistr;
|
import util::common::uistr;
|
||||||
import util::common::log_expr;
|
import util::common::log_expr;
|
||||||
import util::common::log_fn;
|
import util::common::log_fn;
|
||||||
|
@ -101,9 +100,8 @@ fn find_pre_post_obj(&crate_ctxt ccx, _obj o) {
|
||||||
|
|
||||||
fn find_pre_post_item(&crate_ctxt ccx, &item i) {
|
fn find_pre_post_item(&crate_ctxt ccx, &item i) {
|
||||||
alt (i.node) {
|
alt (i.node) {
|
||||||
case (item_const(?id, ?t, ?e, _, ?di, ?a)) {
|
case (item_const(_, ?e)) {
|
||||||
// make a fake fcx
|
// make a fake fcx
|
||||||
|
|
||||||
auto fake_fcx =
|
auto fake_fcx =
|
||||||
rec(enclosing=rec(constrs=@new_def_hash[constraint](),
|
rec(enclosing=rec(constrs=@new_def_hash[constraint](),
|
||||||
num_constraints=0u,
|
num_constraints=0u,
|
||||||
|
@ -113,18 +111,19 @@ fn find_pre_post_item(&crate_ctxt ccx, &item i) {
|
||||||
ccx=ccx);
|
ccx=ccx);
|
||||||
find_pre_post_expr(fake_fcx, e);
|
find_pre_post_expr(fake_fcx, e);
|
||||||
}
|
}
|
||||||
case (item_fn(?id, ?f, ?ps, _, ?di, ?a)) {
|
case (item_fn(?f, ?ps)) {
|
||||||
assert (ccx.fm.contains_key(di));
|
assert (ccx.fm.contains_key(i.id));
|
||||||
auto fcx = rec(enclosing=ccx.fm.get(di), id=di, name=id, ccx=ccx);
|
auto fcx = rec(enclosing=ccx.fm.get(i.id), id=i.id,
|
||||||
|
name=i.ident, ccx=ccx);
|
||||||
find_pre_post_fn(fcx, f);
|
find_pre_post_fn(fcx, f);
|
||||||
}
|
}
|
||||||
case (item_mod(?id, ?m, _, ?di)) { find_pre_post_mod(m); }
|
case (item_mod(?m)) { find_pre_post_mod(m); }
|
||||||
case (item_native_mod(?id, ?nm, _, ?di)) {
|
case (item_native_mod(?nm)) {
|
||||||
find_pre_post_native_mod(nm);
|
find_pre_post_native_mod(nm);
|
||||||
}
|
}
|
||||||
case (item_ty(_, _, _, _, _, _)) { ret; }
|
case (item_ty(_, _)) { ret; }
|
||||||
case (item_tag(_, _, _, _, _, _)) { ret; }
|
case (item_tag(_, _)) { ret; }
|
||||||
case (item_obj(?id, ?o, ?ps, _, ?di, ?a)) {
|
case (item_obj(?o, _, _)) {
|
||||||
find_pre_post_obj(ccx, o);
|
find_pre_post_obj(ccx, o);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -66,7 +66,6 @@ import middle::ty::expr_ty;
|
||||||
import middle::ty::type_is_nil;
|
import middle::ty::type_is_nil;
|
||||||
import middle::ty::type_is_bot;
|
import middle::ty::type_is_bot;
|
||||||
import util::common::new_def_hash;
|
import util::common::new_def_hash;
|
||||||
import util::common::decl_lhs;
|
|
||||||
import util::common::uistr;
|
import util::common::uistr;
|
||||||
import util::common::log_expr;
|
import util::common::log_expr;
|
||||||
import util::common::log_block;
|
import util::common::log_block;
|
||||||
|
|
|
@ -1507,26 +1507,6 @@ fn pat_ty(&ctxt cx, &@ast::pat pat) -> t {
|
||||||
ret ann_to_monotype(cx, pat_ann(pat));
|
ret ann_to_monotype(cx, pat_ann(pat));
|
||||||
}
|
}
|
||||||
|
|
||||||
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_mod(_, _, _, _)) {
|
|
||||||
log_err "a module was passed to item_ann(), " +
|
|
||||||
"but modules haven't annotations";
|
|
||||||
fail;
|
|
||||||
}
|
|
||||||
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; }
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
fn expr_ann(&@ast::expr e) -> ast::ann {
|
fn expr_ann(&@ast::expr e) -> ast::ann {
|
||||||
alt (e.node) {
|
alt (e.node) {
|
||||||
case (ast::expr_vec(_, _, _, ?a)) { ret a; }
|
case (ast::expr_vec(_, _, _, ?a)) { ret a; }
|
||||||
|
@ -2441,7 +2421,7 @@ fn tag_variants(&ctxt cx, &ast::def_id id) -> vec[variant_info] {
|
||||||
alt (cx.items.get(id)) {
|
alt (cx.items.get(id)) {
|
||||||
case (any_item_rust(?item)) {
|
case (any_item_rust(?item)) {
|
||||||
alt (item.node) {
|
alt (item.node) {
|
||||||
case (ast::item_tag(_, ?variants, _, _, _, _)) {
|
case (ast::item_tag(?variants, _)) {
|
||||||
let vec[variant_info] result = [];
|
let vec[variant_info] result = [];
|
||||||
for (ast::variant variant in variants) {
|
for (ast::variant variant in variants) {
|
||||||
auto ctor_ty = ann_to_monotype(cx, variant.node.ann);
|
auto ctor_ty = ann_to_monotype(cx, variant.node.ann);
|
||||||
|
|
|
@ -559,24 +559,24 @@ mod collect {
|
||||||
auto get = bind getter(cx, _);
|
auto get = bind getter(cx, _);
|
||||||
auto convert = bind ast_ty_to_ty(cx.tcx, get, _);
|
auto convert = bind ast_ty_to_ty(cx.tcx, get, _);
|
||||||
alt (it.node) {
|
alt (it.node) {
|
||||||
case (ast::item_const(?ident, ?t, _, _, ?def_id, _)) {
|
case (ast::item_const(?t, _)) {
|
||||||
auto typ = convert(t);
|
auto typ = convert(t);
|
||||||
auto tpt = tup(0u, typ);
|
auto tpt = tup(0u, typ);
|
||||||
cx.tcx.tcache.insert(def_id, tpt);
|
cx.tcx.tcache.insert(it.id, tpt);
|
||||||
ret tpt;
|
ret tpt;
|
||||||
}
|
}
|
||||||
case (ast::item_fn(?ident, ?fn_info, ?tps, _, ?def_id, _)) {
|
case (ast::item_fn(?fn_info, ?tps)) {
|
||||||
auto f = bind ty_of_arg(cx, _);
|
auto f = bind ty_of_arg(cx, _);
|
||||||
ret ty_of_fn_decl(cx, convert, f, fn_info.decl, fn_info.proto,
|
ret ty_of_fn_decl(cx, convert, f, fn_info.decl, fn_info.proto,
|
||||||
tps, some(def_id));
|
tps, some(it.id));
|
||||||
}
|
}
|
||||||
case (ast::item_obj(?ident, ?obj_info, ?tps, _, ?odid, _)) {
|
case (ast::item_obj(?obj_info, ?tps, _)) {
|
||||||
auto t_obj = ty_of_obj(cx, ident, obj_info, tps);
|
auto t_obj = ty_of_obj(cx, it.ident, obj_info, tps);
|
||||||
cx.tcx.tcache.insert(odid.ty, t_obj);
|
cx.tcx.tcache.insert(it.id, t_obj);
|
||||||
ret t_obj;
|
ret t_obj;
|
||||||
}
|
}
|
||||||
case (ast::item_ty(?ident, ?t, ?tps, _, ?def_id, _)) {
|
case (ast::item_ty(?t, ?tps)) {
|
||||||
alt (cx.tcx.tcache.find(def_id)) {
|
alt (cx.tcx.tcache.find(it.id)) {
|
||||||
case (some(?tpt)) { ret tpt; }
|
case (some(?tpt)) { ret tpt; }
|
||||||
case (none) { }
|
case (none) { }
|
||||||
}
|
}
|
||||||
|
@ -586,10 +586,10 @@ mod collect {
|
||||||
auto typ = convert(t);
|
auto typ = convert(t);
|
||||||
auto ty_param_count = vec::len[ast::ty_param](tps);
|
auto ty_param_count = vec::len[ast::ty_param](tps);
|
||||||
auto tpt = tup(ty_param_count, typ);
|
auto tpt = tup(ty_param_count, typ);
|
||||||
cx.tcx.tcache.insert(def_id, tpt);
|
cx.tcx.tcache.insert(it.id, tpt);
|
||||||
ret tpt;
|
ret tpt;
|
||||||
}
|
}
|
||||||
case (ast::item_tag(_, _, ?tps, _, ?def_id, _)) {
|
case (ast::item_tag(_, ?tps)) {
|
||||||
// Create a new generic polytype.
|
// Create a new generic polytype.
|
||||||
|
|
||||||
let vec[ty::t] subtys = [];
|
let vec[ty::t] subtys = [];
|
||||||
|
@ -598,28 +598,27 @@ mod collect {
|
||||||
subtys += [ty::mk_param(cx.tcx, i)];
|
subtys += [ty::mk_param(cx.tcx, i)];
|
||||||
i += 1u;
|
i += 1u;
|
||||||
}
|
}
|
||||||
auto t = ty::mk_tag(cx.tcx, def_id, subtys);
|
auto t = ty::mk_tag(cx.tcx, it.id, subtys);
|
||||||
auto ty_param_count = vec::len[ast::ty_param](tps);
|
auto ty_param_count = vec::len[ast::ty_param](tps);
|
||||||
auto tpt = tup(ty_param_count, t);
|
auto tpt = tup(ty_param_count, t);
|
||||||
cx.tcx.tcache.insert(def_id, tpt);
|
cx.tcx.tcache.insert(it.id, tpt);
|
||||||
ret tpt;
|
ret tpt;
|
||||||
}
|
}
|
||||||
case (ast::item_mod(_, _, _, _)) { fail; }
|
case (ast::item_mod(_)) { fail; }
|
||||||
case (ast::item_native_mod(_, _, _, _)) { fail; }
|
case (ast::item_native_mod(_)) { fail; }
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
fn ty_of_native_item(&@ctxt cx, &@ast::native_item it,
|
fn ty_of_native_item(&@ctxt cx, &@ast::native_item it,
|
||||||
ast::native_abi abi) -> ty::ty_param_count_and_ty {
|
ast::native_abi abi) -> ty::ty_param_count_and_ty {
|
||||||
alt (it.node) {
|
alt (it.node) {
|
||||||
case (ast::native_item_fn(?ident, ?lname, ?fn_decl, ?params,
|
case (ast::native_item_fn(_, _, ?fn_decl, ?params, ?did, _)) {
|
||||||
?def_id, _)) {
|
|
||||||
auto get = bind getter(cx, _);
|
auto get = bind getter(cx, _);
|
||||||
auto convert = bind ast_ty_to_ty(cx.tcx, get, _);
|
auto convert = bind ast_ty_to_ty(cx.tcx, get, _);
|
||||||
auto f = bind ty_of_arg(cx, _);
|
auto f = bind ty_of_arg(cx, _);
|
||||||
ret ty_of_native_fn_decl(cx, convert, f, fn_decl, abi, params,
|
ret ty_of_native_fn_decl(cx, convert, f, fn_decl, abi, params,
|
||||||
def_id);
|
did);
|
||||||
}
|
}
|
||||||
case (ast::native_item_ty(_, ?def_id)) {
|
case (ast::native_item_ty(?tpt, ?def_id)) {
|
||||||
alt (cx.tcx.tcache.find(def_id)) {
|
alt (cx.tcx.tcache.find(def_id)) {
|
||||||
case (some(?tpt)) { ret tpt; }
|
case (some(?tpt)) { ret tpt; }
|
||||||
case (none) { }
|
case (none) { }
|
||||||
|
@ -676,14 +675,14 @@ mod collect {
|
||||||
}
|
}
|
||||||
fn collect(ty::item_table id_to_ty_item, &@ast::item i) {
|
fn collect(ty::item_table id_to_ty_item, &@ast::item i) {
|
||||||
alt (i.node) {
|
alt (i.node) {
|
||||||
case (ast::item_ty(_, _, _, _, ?def_id, _)) {
|
case (ast::item_ty(_, _)) {
|
||||||
id_to_ty_item.insert(def_id, ty::any_item_rust(i));
|
id_to_ty_item.insert(i.id, ty::any_item_rust(i));
|
||||||
}
|
}
|
||||||
case (ast::item_tag(_, _, _, _, ?def_id, _)) {
|
case (ast::item_tag(_, _)) {
|
||||||
id_to_ty_item.insert(def_id, ty::any_item_rust(i));
|
id_to_ty_item.insert(i.id, ty::any_item_rust(i));
|
||||||
}
|
}
|
||||||
case (ast::item_obj(_, _, _, _, ?odid, _)) {
|
case (ast::item_obj(_, _, _)) {
|
||||||
id_to_ty_item.insert(odid.ty, ty::any_item_rust(i));
|
id_to_ty_item.insert(i.id, ty::any_item_rust(i));
|
||||||
}
|
}
|
||||||
case (_) {/* empty */ }
|
case (_) {/* empty */ }
|
||||||
}
|
}
|
||||||
|
@ -702,23 +701,22 @@ mod collect {
|
||||||
fn convert(@ctxt cx, @mutable option::t[ast::native_abi] abi,
|
fn convert(@ctxt cx, @mutable option::t[ast::native_abi] abi,
|
||||||
&@ast::item it) {
|
&@ast::item it) {
|
||||||
alt (it.node) {
|
alt (it.node) {
|
||||||
case (ast::item_mod(_, _, _, _)) {
|
case (ast::item_mod(_)) {
|
||||||
// ignore item_mod, it has no type.
|
// 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,
|
// Propagate the native ABI down to convert_native() below,
|
||||||
// but otherwise do nothing, as native modules have no types.
|
// but otherwise do nothing, as native modules have no types.
|
||||||
|
|
||||||
*abi = some[ast::native_abi](native_mod.abi);
|
*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)) {
|
||||||
auto tpt = ty_of_item(cx, it);
|
auto tpt = ty_of_item(cx, it);
|
||||||
write::ty_only(cx.tcx, ann.id, tpt._1);
|
write::ty_only(cx.tcx, it.ann.id, tpt._1);
|
||||||
get_tag_variant_types(cx, tag_id, variants, ty_params);
|
get_tag_variant_types(cx, it.id, variants, ty_params);
|
||||||
}
|
}
|
||||||
case (ast::item_obj(?ident, ?object, ?ty_params, _, ?odid, ?ann))
|
case (ast::item_obj(?object, ?ty_params, ?ctor_id)) {
|
||||||
{
|
|
||||||
// This calls ty_of_obj().
|
// This calls ty_of_obj().
|
||||||
|
|
||||||
auto t_obj = ty_of_item(cx, it);
|
auto t_obj = ty_of_item(cx, it);
|
||||||
|
@ -726,8 +724,8 @@ mod collect {
|
||||||
// we write into the table for this item.
|
// we write into the table for this item.
|
||||||
|
|
||||||
auto tpt =
|
auto tpt =
|
||||||
ty_of_obj_ctor(cx, ident, object, odid.ctor, ty_params);
|
ty_of_obj_ctor(cx, it.ident, object, ctor_id, ty_params);
|
||||||
write::ty_only(cx.tcx, ann.id, tpt._1);
|
write::ty_only(cx.tcx, it.ann.id, tpt._1);
|
||||||
// Write the methods into the type table.
|
// Write the methods into the type table.
|
||||||
//
|
//
|
||||||
// FIXME: Inefficient; this ends up calling
|
// FIXME: Inefficient; this ends up calling
|
||||||
|
@ -771,7 +769,7 @@ mod collect {
|
||||||
// it into the node type table.
|
// it into the node type table.
|
||||||
|
|
||||||
auto tpt = ty_of_item(cx, it);
|
auto tpt = ty_of_item(cx, it);
|
||||||
write::ty_only(cx.tcx, ty::item_ann(it).id, tpt._1);
|
write::ty_only(cx.tcx, it.ann.id, tpt._1);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -788,8 +786,8 @@ mod collect {
|
||||||
// FIXME: Native types have no annotation. Should they? --pcw
|
// FIXME: Native types have no annotation. Should they? --pcw
|
||||||
|
|
||||||
}
|
}
|
||||||
case (ast::native_item_fn(_, _, _, _, _, ?a)) {
|
case (ast::native_item_fn(_, _, _, _, _, ?ann)) {
|
||||||
write::ty_only(cx.tcx, a.id, tpt._1);
|
write::ty_only(cx.tcx, ann.id, tpt._1);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -2327,18 +2325,17 @@ fn check_method(&@crate_ctxt ccx, &@ast::method method) {
|
||||||
|
|
||||||
fn check_item(@crate_ctxt ccx, &@ast::item it) {
|
fn check_item(@crate_ctxt ccx, &@ast::item it) {
|
||||||
alt (it.node) {
|
alt (it.node) {
|
||||||
case (ast::item_const(_, _, ?e, _, _, ?a)) {
|
case (ast::item_const(_, ?e)) {
|
||||||
check_const(ccx, it.span, e, a);
|
check_const(ccx, it.span, e, it.ann);
|
||||||
}
|
}
|
||||||
case (ast::item_fn(_, ?f, _, _, _, ?a)) {
|
case (ast::item_fn(?f, _)) {
|
||||||
check_fn(ccx, f.decl, f.proto, f.body, a);
|
check_fn(ccx, f.decl, f.proto, f.body, it.ann);
|
||||||
}
|
}
|
||||||
case (ast::item_obj(_, ?ob, _, _, ?obj_def_ids, _)) {
|
case (ast::item_obj(?ob, _, _)) {
|
||||||
// We're entering an object, so gather up the info we need.
|
// 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,
|
vec::push[obj_info](ccx.obj_infos,
|
||||||
rec(obj_fields=ob.fields, this_obj=di));
|
rec(obj_fields=ob.fields, this_obj=it.id));
|
||||||
// Typecheck the methods.
|
// Typecheck the methods.
|
||||||
|
|
||||||
for (@ast::method method in ob.methods) {
|
for (@ast::method method in ob.methods) {
|
||||||
|
@ -2357,8 +2354,8 @@ fn mk_fn_purity_table(&@ast::crate crate) -> @fn_purity_table {
|
||||||
auto res = @new_def_hash[ast::purity]();
|
auto res = @new_def_hash[ast::purity]();
|
||||||
fn do_one(@fn_purity_table t, &@ast::item i) {
|
fn do_one(@fn_purity_table t, &@ast::item i) {
|
||||||
alt (i.node) {
|
alt (i.node) {
|
||||||
case (ast::item_fn(_, ?f, _, _, ?d_id, _)) {
|
case (ast::item_fn(?f, _)) {
|
||||||
t.insert(d_id, f.decl.purity);
|
t.insert(i.id, f.decl.purity);
|
||||||
}
|
}
|
||||||
case (_) { }
|
case (_) { }
|
||||||
}
|
}
|
||||||
|
|
|
@ -99,15 +99,15 @@ fn visit_local[E](&@local loc, &E e, &vt[E] v) {
|
||||||
|
|
||||||
fn visit_item[E](&@item i, &E e, &vt[E] v) {
|
fn visit_item[E](&@item i, &E e, &vt[E] v) {
|
||||||
alt (i.node) {
|
alt (i.node) {
|
||||||
case (item_const(_, ?t, ?ex, _, _, _)) {
|
case (item_const(?t, ?ex)) {
|
||||||
vt(v).visit_ty(t, e, v);
|
vt(v).visit_ty(t, e, v);
|
||||||
vt(v).visit_expr(ex, e, v);
|
vt(v).visit_expr(ex, e, v);
|
||||||
}
|
}
|
||||||
case (item_fn(?nm, ?f, ?tp, _, ?d, ?a)) {
|
case (item_fn(?f, ?tp)) {
|
||||||
vt(v).visit_fn(f, tp, i.span, nm, d, a, e, v);
|
vt(v).visit_fn(f, tp, i.span, i.ident, i.id, i.ann, e, v);
|
||||||
}
|
}
|
||||||
case (item_mod(_, ?m, _, _)) { vt(v).visit_mod(m, i.span, 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) {
|
for (@view_item vi in nm.view_items) {
|
||||||
vt(v).visit_view_item(vi, e, v);
|
vt(v).visit_view_item(vi, e, v);
|
||||||
}
|
}
|
||||||
|
@ -115,15 +115,15 @@ fn visit_item[E](&@item i, &E e, &vt[E] v) {
|
||||||
vt(v).visit_native_item(ni, e, v);
|
vt(v).visit_native_item(ni, e, v);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
case (item_ty(_, ?t, _, _, _, _)) { vt(v).visit_ty(t, e, v); }
|
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 vr in variants) {
|
||||||
for (variant_arg va in vr.node.args) {
|
for (variant_arg va in vr.node.args) {
|
||||||
vt(v).visit_ty(va.ty, e, v);
|
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); }
|
for (obj_field f in ob.fields) { vt(v).visit_ty(f.ty, e, v); }
|
||||||
for (@method m in ob.methods) {
|
for (@method m in ob.methods) {
|
||||||
vt(v).visit_fn(m.node.meth, [], m.span, m.node.ident,
|
vt(v).visit_fn(m.node.meth, [], m.span, m.node.ident,
|
||||||
|
|
|
@ -103,24 +103,24 @@ fn walk_item(&ast_visitor v, @ast::item i) {
|
||||||
if (!v.keep_going()) { ret; }
|
if (!v.keep_going()) { ret; }
|
||||||
v.visit_item_pre(i);
|
v.visit_item_pre(i);
|
||||||
alt (i.node) {
|
alt (i.node) {
|
||||||
case (ast::item_const(_, ?t, ?e, _, _, _)) {
|
case (ast::item_const(?t, ?e)) {
|
||||||
walk_ty(v, t);
|
walk_ty(v, t);
|
||||||
walk_expr(v, e);
|
walk_expr(v, e);
|
||||||
}
|
}
|
||||||
case (ast::item_fn(?nm, ?f, _, _, ?d, ?a)) {
|
case (ast::item_fn(?f, _)) {
|
||||||
walk_fn(v, f, i.span, nm, d, a);
|
walk_fn(v, f, i.span, i.ident, i.id, i.ann);
|
||||||
}
|
}
|
||||||
case (ast::item_mod(_, ?m, _, _)) { walk_mod(v, m); }
|
case (ast::item_mod(?m)) { walk_mod(v, m); }
|
||||||
case (ast::item_native_mod(_, ?nm, _, _)) { walk_native_mod(v, nm); }
|
case (ast::item_native_mod(?nm)) { walk_native_mod(v, nm); }
|
||||||
case (ast::item_ty(_, ?t, _, _, _, _)) { walk_ty(v, 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 vr in variants) {
|
||||||
for (ast::variant_arg va in vr.node.args) {
|
for (ast::variant_arg va in vr.node.args) {
|
||||||
walk_ty(v, va.ty);
|
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); }
|
for (ast::obj_field f in ob.fields) { walk_ty(v, f.ty); }
|
||||||
for (@ast::method m in ob.methods) {
|
for (@ast::method m in ob.methods) {
|
||||||
v.visit_method_pre(m);
|
v.visit_method_pre(m);
|
||||||
|
|
|
@ -259,12 +259,12 @@ fn print_item(&ps s, &@ast::item item) {
|
||||||
hardbreak(s.s);
|
hardbreak(s.s);
|
||||||
maybe_print_comment(s, item.span.lo);
|
maybe_print_comment(s, item.span.lo);
|
||||||
alt (item.node) {
|
alt (item.node) {
|
||||||
case (ast::item_const(?id, ?ty, ?expr, ?attrs, _, _)) {
|
case (ast::item_const(?ty, ?expr)) {
|
||||||
print_outer_attributes(s, attrs);
|
print_outer_attributes(s, item.attrs);
|
||||||
head(s, "const");
|
head(s, "const");
|
||||||
print_type(s, *ty);
|
print_type(s, *ty);
|
||||||
space(s.s);
|
space(s.s);
|
||||||
word_space(s, id);
|
word_space(s, item.ident);
|
||||||
end(s); // end the head-ibox
|
end(s); // end the head-ibox
|
||||||
|
|
||||||
word_space(s, "=");
|
word_space(s, "=");
|
||||||
|
@ -273,22 +273,22 @@ fn print_item(&ps s, &@ast::item item) {
|
||||||
end(s); // end the outer cbox
|
end(s); // end the outer cbox
|
||||||
|
|
||||||
}
|
}
|
||||||
case (ast::item_fn(?name, ?_fn, ?typarams, ?attrs, _, _)) {
|
case (ast::item_fn(?_fn, ?typarams)) {
|
||||||
print_outer_attributes(s, attrs);
|
print_outer_attributes(s, item.attrs);
|
||||||
print_fn(s, _fn.decl, _fn.proto, name, typarams);
|
print_fn(s, _fn.decl, _fn.proto, item.ident, typarams);
|
||||||
word(s.s, " ");
|
word(s.s, " ");
|
||||||
print_block(s, _fn.body);
|
print_block(s, _fn.body);
|
||||||
}
|
}
|
||||||
case (ast::item_mod(?id, ?_mod, ?attrs, _)) {
|
case (ast::item_mod(?_mod)) {
|
||||||
print_outer_attributes(s, attrs);
|
print_outer_attributes(s, item.attrs);
|
||||||
head(s, "mod");
|
head(s, "mod");
|
||||||
word_nbsp(s, id);
|
word_nbsp(s, item.ident);
|
||||||
bopen(s);
|
bopen(s);
|
||||||
for (@ast::item itm in _mod.items) { print_item(s, itm); }
|
for (@ast::item itm in _mod.items) { print_item(s, itm); }
|
||||||
bclose(s, item.span);
|
bclose(s, item.span);
|
||||||
}
|
}
|
||||||
case (ast::item_native_mod(?id, ?nmod, ?attrs, _)) {
|
case (ast::item_native_mod(?nmod)) {
|
||||||
print_outer_attributes(s, attrs);
|
print_outer_attributes(s, item.attrs);
|
||||||
head(s, "native");
|
head(s, "native");
|
||||||
alt (nmod.abi) {
|
alt (nmod.abi) {
|
||||||
case (ast::native_abi_rust) { word_nbsp(s, "\"rust\""); }
|
case (ast::native_abi_rust) { word_nbsp(s, "\"rust\""); }
|
||||||
|
@ -298,7 +298,7 @@ fn print_item(&ps s, &@ast::item item) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
word_nbsp(s, "mod");
|
word_nbsp(s, "mod");
|
||||||
word_nbsp(s, id);
|
word_nbsp(s, item.ident);
|
||||||
bopen(s);
|
bopen(s);
|
||||||
for (@ast::native_item item in nmod.items) {
|
for (@ast::native_item item in nmod.items) {
|
||||||
hardbreak(s.s);
|
hardbreak(s.s);
|
||||||
|
@ -331,12 +331,12 @@ fn print_item(&ps s, &@ast::item item) {
|
||||||
}
|
}
|
||||||
bclose(s, item.span);
|
bclose(s, item.span);
|
||||||
}
|
}
|
||||||
case (ast::item_ty(?id, ?ty, ?params, ?attrs, _, _)) {
|
case (ast::item_ty(?ty, ?params)) {
|
||||||
print_outer_attributes(s, attrs);
|
print_outer_attributes(s, item.attrs);
|
||||||
ibox(s, indent_unit);
|
ibox(s, indent_unit);
|
||||||
ibox(s, 0u);
|
ibox(s, 0u);
|
||||||
word_nbsp(s, "type");
|
word_nbsp(s, "type");
|
||||||
word(s.s, id);
|
word(s.s, item.ident);
|
||||||
print_type_params(s, params);
|
print_type_params(s, params);
|
||||||
end(s); // end the inner ibox
|
end(s); // end the inner ibox
|
||||||
|
|
||||||
|
@ -348,10 +348,10 @@ fn print_item(&ps s, &@ast::item item) {
|
||||||
|
|
||||||
break_offset(s.s, 0u, 0);
|
break_offset(s.s, 0u, 0);
|
||||||
}
|
}
|
||||||
case (ast::item_tag(?id, ?variants, ?params, ?attrs, _, _)) {
|
case (ast::item_tag(?variants, ?params)) {
|
||||||
print_outer_attributes(s, attrs);
|
print_outer_attributes(s, item.attrs);
|
||||||
head(s, "tag");
|
head(s, "tag");
|
||||||
word(s.s, id);
|
word(s.s, item.ident);
|
||||||
print_type_params(s, params);
|
print_type_params(s, params);
|
||||||
space(s.s);
|
space(s.s);
|
||||||
bopen(s);
|
bopen(s);
|
||||||
|
@ -372,10 +372,10 @@ fn print_item(&ps s, &@ast::item item) {
|
||||||
}
|
}
|
||||||
bclose(s, item.span);
|
bclose(s, item.span);
|
||||||
}
|
}
|
||||||
case (ast::item_obj(?id, ?_obj, ?params, ?attrs, _, _)) {
|
case (ast::item_obj(?_obj, ?params, _)) {
|
||||||
print_outer_attributes(s, attrs);
|
print_outer_attributes(s, item.attrs);
|
||||||
head(s, "obj");
|
head(s, "obj");
|
||||||
word(s.s, id);
|
word(s.s, item.ident);
|
||||||
print_type_params(s, params);
|
print_type_params(s, params);
|
||||||
popen(s);
|
popen(s);
|
||||||
fn print_field(&ps s, &ast::obj_field field) {
|
fn print_field(&ps s, &ast::obj_field field) {
|
||||||
|
@ -415,7 +415,7 @@ fn print_item(&ps s, &@ast::item item) {
|
||||||
alt (s.mode) {
|
alt (s.mode) {
|
||||||
case (mo_identified) {
|
case (mo_identified) {
|
||||||
space(s.s);
|
space(s.s);
|
||||||
synth_comment(s, uint::to_str(ty::item_ann(item).id, 10u));
|
synth_comment(s, uint::to_str(item.ann.id, 10u));
|
||||||
}
|
}
|
||||||
case (_) {/* no-op */ }
|
case (_) {/* no-op */ }
|
||||||
}
|
}
|
||||||
|
|
|
@ -148,26 +148,6 @@ fn log_stmt(&ast::stmt st) { log pretty::pprust::stmt_to_str(st); }
|
||||||
|
|
||||||
fn log_stmt_err(&ast::stmt st) { log_err pretty::pprust::stmt_to_str(st); }
|
fn log_stmt_err(&ast::stmt st) { log_err pretty::pprust::stmt_to_str(st); }
|
||||||
|
|
||||||
fn decl_lhs(@ast::decl d) -> ast::def_id {
|
|
||||||
alt (d.node) {
|
|
||||||
case (ast::decl_local(?l)) { ret l.id; }
|
|
||||||
case (ast::decl_item(?an_item)) {
|
|
||||||
alt (an_item.node) {
|
|
||||||
case (ast::item_const(_, _, _, _, ?d, _)) { ret d; }
|
|
||||||
case (ast::item_fn(_, _, _, _, ?d, _)) { ret d; }
|
|
||||||
case (ast::item_mod(_, _, _, ?d)) { ret d; }
|
|
||||||
case (ast::item_native_mod(_, _, _, ?d)) { ret d; }
|
|
||||||
case (ast::item_ty(_, _, _, _, ?d, _)) { ret d; }
|
|
||||||
case (ast::item_tag(_, _, _, _, ?d, _)) { ret d; }
|
|
||||||
case (ast::item_obj(_, _, _, _, ?d, _)) {
|
|
||||||
ret d.ctor; /* This doesn't really make sense */
|
|
||||||
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
fn has_nonlocal_exits(&ast::block b) -> bool {
|
fn has_nonlocal_exits(&ast::block b) -> bool {
|
||||||
auto has_exits = @mutable false;
|
auto has_exits = @mutable false;
|
||||||
fn visit_expr(@mutable bool flag, &@ast::expr e) {
|
fn visit_expr(@mutable bool flag, &@ast::expr e) {
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue