use syntax::ast_map;
use syntax::attr;
use syntax::diagnostic::span_handler;
-use syntax::parse::token::{ident_interner, special_idents};
+use syntax::parse::token::ident_interner;
use syntax::print::pprust;
use syntax::{ast, ast_util};
use syntax::codemap;
let t = doc_type(item, tcx, cdata);
if family_names_type(item_family(item)) {
ty::mk_with_id(tcx, t, item_id)
- } else {
- t
- }
+ } else { t }
}
fn item_impl_traits(item: ebml::Doc, tcx: ty::ctxt, cdata: cmd) -> ~[ty::t] {
rslt
}
-pub fn get_impls_for_mod(intr: @ident_interner,
- cdata: cmd,
- m_id: ast::node_id,
- name: Option<ast::ident>,
- get_cdata: &fn(ast::crate_num) -> cmd)
+pub fn get_impls_for_mod(intr: @ident_interner, cdata: cmd,
+ m_id: ast::node_id, name: Option<ast::ident>,
+ get_cdata: fn(ast::crate_num) -> cmd)
-> @~[@_impl] {
+
let data = cdata.data;
let mod_item = lookup_item(m_id, data);
let mut result = ~[];
});
}
}
- for reader::tagged_docs(item, tag_item_unnamed_field) |an_item| {
- let did = item_def_id(an_item, cdata);
- result.push(ty::field_ty {
- ident: special_idents::unnamed_field,
- id: did,
- vis: ast::inherited,
- mutability: ast::struct_immutable,
- });
- }
result
}
use syntax::ast_util::*;
use syntax::attr;
use syntax::diagnostic::span_handler;
-use syntax::parse::token::special_idents;
use syntax::print::pprust;
use syntax::{ast_util, visit};
use syntax;
// Encode info about all the module children.
for md.items.each |item| {
match item.node {
- item_impl(*) => {
+ item_impl(*) | item_struct(*) => {
let (ident, did) = (item.ident, item.id);
debug!("(encoding info for module) ... encoding impl %s \
(%?/%?)",
/* We encode both private and public fields -- need to include
private fields to get the offsets right */
for fields.each |field| {
- let (nm, mt, vis) = match field.node.kind {
- named_field(nm, mt, vis) => (nm, mt, vis),
- unnamed_field => (
- special_idents::unnamed_field,
- struct_immutable,
- inherited
- )
- };
-
- let id = field.node.id;
- index.push({val: id, pos: ebml_w.writer.tell()});
- global_index.push({val: id, pos: ebml_w.writer.tell()});
- ebml_w.start_tag(tag_items_data_item);
- debug!("encode_info_for_struct: doing %s %d",
- tcx.sess.str_of(nm), id);
- encode_visibility(ebml_w, vis);
- encode_name(ecx, ebml_w, nm);
- encode_path(ecx, ebml_w, path, ast_map::path_name(nm));
- encode_type(ecx, ebml_w, node_id_to_type(tcx, id));
- encode_mutability(ebml_w, mt);
- encode_def_id(ebml_w, local_def(id));
- ebml_w.end_tag();
+ match field.node.kind {
+ named_field(nm, mt, vis) => {
+ let id = field.node.id;
+ index.push({val: id, pos: ebml_w.writer.tell()});
+ global_index.push({val: id,
+ pos: ebml_w.writer.tell()});
+ ebml_w.start_tag(tag_items_data_item);
+ debug!("encode_info_for_struct: doing %s %d",
+ tcx.sess.str_of(nm), id);
+ encode_visibility(ebml_w, vis);
+ encode_name(ecx, ebml_w, nm);
+ encode_path(ecx, ebml_w, path, ast_map::path_name(nm));
+ encode_type(ecx, ebml_w, node_id_to_type(tcx, id));
+ encode_mutability(ebml_w, mt);
+ encode_def_id(ebml_w, local_def(id));
+ ebml_w.end_tag();
+ }
+ unnamed_field => {}
+ }
}
/*bad*/copy *index
}
encode_def_id(ebml_w, local_def(item.id));
encode_family(ebml_w, 'S');
encode_type_param_bounds(ebml_w, ecx, tps);
-
- // If this is a tuple- or enum-like struct, encode the type of the
- // constructor. Otherwise, encode the type of the struct.
- if struct_def.fields.len() > 0 &&
- struct_def.fields[0].node.kind == ast::unnamed_field {
- // Tuple- or enum-like struct.
- let ctor_id = match struct_def.ctor_id {
- Some(ctor_id) => ctor_id,
- None => ecx.tcx.sess.bug(~"struct def didn't have ctor id"),
- };
- encode_type(ecx, ebml_w, node_id_to_type(tcx, ctor_id));
-
- // Also encode the symbol.
- encode_symbol(ecx, ebml_w, ctor_id);
- } else {
- encode_type(ecx, ebml_w, node_id_to_type(tcx, item.id));
- }
-
+ encode_type(ecx, ebml_w, node_id_to_type(tcx, item.id));
encode_name(ecx, ebml_w, item.ident);
encode_path(ecx, ebml_w, path, ast_map::path_name(item.ident));
encode_region_param(ecx, ebml_w, item);
encode_def_id(ebml_w, local_def(f.node.id));
ebml_w.end_tag();
}
- unnamed_field => {
- ebml_w.start_tag(tag_item_unnamed_field);
- encode_def_id(ebml_w, local_def(f.node.id));
- ebml_w.end_tag();
- }
+ unnamed_field => {}
}
}
use driver::session;
use driver::session::Session;
use metadata::csearch::{each_path, get_method_names_if_trait};
-use metadata::csearch::{get_static_methods_if_impl, get_struct_fields};
-use metadata::csearch::{get_type_name_if_impl};
+use metadata::csearch::{get_static_methods_if_impl, get_type_name_if_impl};
use metadata::cstore::find_use_stmt_cnum;
use metadata::decoder::{def_like, dl_def, dl_field, dl_impl};
use middle::lang_items::LanguageItems;
crate) building type %s",
final_ident);
child_name_bindings.define_type(Public, def, dummy_sp());
-
- // Define the struct constructor if this is a tuple-like struct.
- let fields = get_struct_fields(self.session.cstore, def_id);
- if fields.len() != 0 &&
- fields[0].ident == special_idents::unnamed_field {
- child_name_bindings.define_value(Public, def, dummy_sp());
- }
-
self.structs.insert(def_id, ());
}
def_self(*) | def_arg(*) | def_local(*) |
OverwriteDuplicates,
dummy_sp());
- self.handle_external_def(def,
- modules,
+ self.handle_external_def(def, modules,
child_name_bindings,
self.session.str_of(final_ident),
- final_ident,
- new_parent);
+ final_ident, new_parent);
}
dl_impl(def) => {
// We only process static methods of impls here.