Updated librustdoc and librustpkg to use the proper UpperCase names from libsyntax.

This commit is contained in:
Eduard Burtescu 2014-01-09 22:25:09 +02:00
parent 6b221768cf
commit 72ee4a57b7
4 changed files with 31 additions and 32 deletions

View File

@ -598,9 +598,9 @@ pub enum Type {
FixedVector(~Type, ~str),
String,
Bool,
/// aka ty_nil
/// aka TyNil
Unit,
/// aka ty_bot
/// aka TyBot
Bottom,
Unique(~Type),
Managed(~Type),
@ -624,22 +624,22 @@ impl Clean<Type> for ast::Ty {
let codemap = local_data::get(super::ctxtkey, |x| *x.unwrap()).sess.codemap;
debug!("span corresponds to `{}`", codemap.span_to_str(self.span));
match self.node {
ty_nil => Unit,
ty_ptr(ref m) => RawPointer(m.mutbl.clean(), ~m.ty.clean()),
ty_rptr(ref l, ref m) =>
TyNil => Unit,
TyPtr(ref m) => RawPointer(m.mutbl.clean(), ~m.ty.clean()),
TyRptr(ref l, ref m) =>
BorrowedRef {lifetime: l.clean(), mutability: m.mutbl.clean(),
type_: ~m.ty.clean()},
ty_box(ty) => Managed(~ty.clean()),
ty_uniq(ty) => Unique(~ty.clean()),
ty_vec(ty) => Vector(~ty.clean()),
ty_fixed_length_vec(ty, ref e) => FixedVector(~ty.clean(),
e.span.to_src()),
ty_tup(ref tys) => Tuple(tys.iter().map(|x| x.clean()).collect()),
ty_path(ref p, ref tpbs, id) =>
TyBox(ty) => Managed(~ty.clean()),
TyUniq(ty) => Unique(~ty.clean()),
TyVec(ty) => Vector(~ty.clean()),
TyFixedLengthVec(ty, ref e) => FixedVector(~ty.clean(),
e.span.to_src()),
TyTup(ref tys) => Tuple(tys.iter().map(|x| x.clean()).collect()),
TyPath(ref p, ref tpbs, id) =>
resolve_type(p.clean(), tpbs.clean(), id),
ty_closure(ref c) => Closure(~c.clean()),
ty_bare_fn(ref barefn) => BareFunction(~barefn.clean()),
ty_bot => Bottom,
TyClosure(ref c) => Closure(~c.clean()),
TyBareFn(ref barefn) => BareFunction(~barefn.clean()),
TyBot => Bottom,
ref x => fail!("Unimplemented type {:?}", x),
}
}
@ -1204,9 +1204,8 @@ fn resolve_type(path: Path, tpbs: Option<~[TyParamBound]>,
let fqn = csearch::get_item_path(tycx, def_id);
let fqn = fqn.move_iter().map(|i| {
match i {
ast_map::path_mod(id) |
ast_map::path_name(id) |
ast_map::path_pretty_name(id, _) => id.clean()
ast_map::PathMod(id) | ast_map::PathName(id) |
ast_map::PathPrettyName(id, _) => id.clean()
}
}).to_owned_vec();
ExternalPath{ path: path, typarams: tpbs, fqn: fqn, kind: kind,

View File

@ -39,7 +39,7 @@ impl Module {
Module {
name : name,
id: 0,
vis: ast::private,
vis: ast::Private,
where: syntax::codemap::DUMMY_SP,
attrs : ~[],
structs : ~[],

View File

@ -121,36 +121,36 @@ impl<'a> RustdocVisitor<'a> {
om
}
pub fn visit_view_item(&mut self, item: &ast::view_item, om: &mut Module) {
if item.vis != ast::public {
pub fn visit_view_item(&mut self, item: &ast::ViewItem, om: &mut Module) {
if item.vis != ast::Public {
return om.view_items.push(item.clone());
}
let item = match item.node {
ast::view_item_use(ref paths) => {
ast::ViewItemUse(ref paths) => {
// rustc no longer supports "use foo, bar;"
assert_eq!(paths.len(), 1);
match self.visit_view_path(paths[0], om) {
None => return,
Some(path) => {
ast::view_item {
node: ast::view_item_use(~[path]),
ast::ViewItem {
node: ast::ViewItemUse(~[path]),
.. item.clone()
}
}
}
}
ast::view_item_extern_mod(..) => item.clone()
ast::ViewItemExternMod(..) => item.clone()
};
om.view_items.push(item);
}
fn visit_view_path(&mut self, path: @ast::view_path,
om: &mut Module) -> Option<@ast::view_path> {
fn visit_view_path(&mut self, path: @ast::ViewPath,
om: &mut Module) -> Option<@ast::ViewPath> {
match path.node {
ast::view_path_simple(_, _, id) => {
ast::ViewPathSimple(_, _, id) => {
if self.resolve_id(id, false, om) { return None }
}
ast::view_path_list(ref p, ref paths, ref b) => {
ast::ViewPathList(ref p, ref paths, ref b) => {
let mut mine = ~[];
for path in paths.iter() {
if !self.resolve_id(path.node.id, false, om) {
@ -160,13 +160,13 @@ impl<'a> RustdocVisitor<'a> {
if mine.len() == 0 { return None }
return Some(@::syntax::codemap::Spanned {
node: ast::view_path_list(p.clone(), mine, b.clone()),
node: ast::ViewPathList(p.clone(), mine, b.clone()),
span: path.span,
})
}
// these are feature gated anyway
ast::view_path_glob(_, id) => {
ast::ViewPathGlob(_, id) => {
if self.resolve_id(id, true, om) { return None }
}
}

View File

@ -88,7 +88,7 @@ struct PkgScript<'a> {
/// The config for compiling the custom build script
cfg: ast::CrateConfig,
/// The crate and ast_map for the custom build script
crate_and_map: Option<(ast::Crate, syntax::ast_map::map)>,
crate_and_map: Option<(ast::Crate, syntax::ast_map::Map)>,
/// Directory in which to store build output
build_dir: Path
}