1
Fork 0

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

View file

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

View file

@ -121,36 +121,36 @@ impl<'a> RustdocVisitor<'a> {
om om
} }
pub fn visit_view_item(&mut self, item: &ast::view_item, om: &mut Module) { pub fn visit_view_item(&mut self, item: &ast::ViewItem, om: &mut Module) {
if item.vis != ast::public { if item.vis != ast::Public {
return om.view_items.push(item.clone()); return om.view_items.push(item.clone());
} }
let item = match item.node { let item = match item.node {
ast::view_item_use(ref paths) => { ast::ViewItemUse(ref paths) => {
// rustc no longer supports "use foo, bar;" // rustc no longer supports "use foo, bar;"
assert_eq!(paths.len(), 1); assert_eq!(paths.len(), 1);
match self.visit_view_path(paths[0], om) { match self.visit_view_path(paths[0], om) {
None => return, None => return,
Some(path) => { Some(path) => {
ast::view_item { ast::ViewItem {
node: ast::view_item_use(~[path]), node: ast::ViewItemUse(~[path]),
.. item.clone() .. item.clone()
} }
} }
} }
} }
ast::view_item_extern_mod(..) => item.clone() ast::ViewItemExternMod(..) => item.clone()
}; };
om.view_items.push(item); om.view_items.push(item);
} }
fn visit_view_path(&mut self, path: @ast::view_path, fn visit_view_path(&mut self, path: @ast::ViewPath,
om: &mut Module) -> Option<@ast::view_path> { om: &mut Module) -> Option<@ast::ViewPath> {
match path.node { match path.node {
ast::view_path_simple(_, _, id) => { ast::ViewPathSimple(_, _, id) => {
if self.resolve_id(id, false, om) { return None } 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 = ~[]; let mut mine = ~[];
for path in paths.iter() { for path in paths.iter() {
if !self.resolve_id(path.node.id, false, om) { if !self.resolve_id(path.node.id, false, om) {
@ -160,13 +160,13 @@ impl<'a> RustdocVisitor<'a> {
if mine.len() == 0 { return None } if mine.len() == 0 { return None }
return Some(@::syntax::codemap::Spanned { 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, span: path.span,
}) })
} }
// these are feature gated anyway // these are feature gated anyway
ast::view_path_glob(_, id) => { ast::ViewPathGlob(_, id) => {
if self.resolve_id(id, true, om) { return None } 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 /// The config for compiling the custom build script
cfg: ast::CrateConfig, cfg: ast::CrateConfig,
/// The crate and ast_map for the custom build script /// 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 /// Directory in which to store build output
build_dir: Path build_dir: Path
} }