rustdoc: Do all maps as util::anymap

This commit is contained in:
Brian Anderson 2012-02-26 23:07:03 -08:00
parent a11638f0d9
commit c15127fe3e
8 changed files with 23 additions and 23 deletions

View File

@ -154,7 +154,7 @@ fn merge_arg_attrs(
docs: [doc::argdoc],
attrs: [attr_parser::arg_attrs]
) -> [doc::argdoc] {
vec::map(docs) {|doc|
util::anymap(docs) {|doc|
alt vec::find(attrs) {|attr|
attr.name == doc.name
} {
@ -239,7 +239,7 @@ fn fold_enum(
let doc = fold::default_seq_fold_enum(fold, doc);
{
variants: vec::map(doc.variants) {|variant|
variants: util::anymap(doc.variants) {|variant|
let attrs = astsrv::exec(srv) {|ctxt|
alt check ctxt.ast_map.get(doc.id()) {
ast_map::node_item(@{
@ -288,7 +288,7 @@ fn fold_res(
let attrs = parse_item_attrs(srv, doc.id(), attr_parser::parse_res);
{
args: vec::map(doc.args) {|doc|
args: util::anymap(doc.args) {|doc|
alt vec::find(attrs.args) {|attr|
attr.name == doc.name
} {
@ -349,7 +349,7 @@ fn merge_method_attrs(
ast_map::node_item(@{
node: ast::item_iface(_, methods), _
}, _) {
vec::map(methods) {|method|
util::seqmap(methods) {|method|
(method.ident,
(attr_parser::parse_basic(method.attrs),
attr_parser::parse_method(method.attrs)
@ -359,7 +359,7 @@ fn merge_method_attrs(
ast_map::node_item(@{
node: ast::item_impl(_, _, _, methods), _
}, _) {
vec::map(methods) {|method|
util::seqmap(methods) {|method|
(method.ident,
(attr_parser::parse_basic(method.attrs),
attr_parser::parse_method(method.attrs)

View File

@ -45,7 +45,7 @@ fn fold_fn(fold: fold::fold<op>, doc: doc::fndoc) -> doc::fndoc {
let doc = fold::default_seq_fold_fn(fold, doc);
{
args: vec::map(doc.args) {|doc|
args: util::anymap(doc.args) {|doc|
{
desc: maybe_apply_op(fold.ctxt, doc.desc)
with doc
@ -64,7 +64,7 @@ fn fold_enum(fold: fold::fold<op>, doc: doc::enumdoc) -> doc::enumdoc {
let doc = fold::default_seq_fold_enum(fold, doc);
{
variants: vec::map(doc.variants) {|variant|
variants: util::anymap(doc.variants) {|variant|
{
desc: maybe_apply_op(fold.ctxt, variant.desc)
with variant
@ -78,7 +78,7 @@ fn fold_res(fold: fold::fold<op>, doc: doc::resdoc) -> doc::resdoc {
let doc = fold::default_seq_fold_res(fold, doc);
{
args: vec::map(doc.args) {|arg|
args: util::anymap(doc.args) {|arg|
{
desc: maybe_apply_op(fold.ctxt, arg.desc)
with arg
@ -98,11 +98,11 @@ fn fold_iface(fold: fold::fold<op>, doc: doc::ifacedoc) -> doc::ifacedoc {
}
fn apply_to_methods(op: op, docs: [doc::methoddoc]) -> [doc::methoddoc] {
vec::map(docs) {|doc|
util::anymap(docs) {|doc|
{
brief: maybe_apply_op(op, doc.brief),
desc: maybe_apply_op(op, doc.desc),
args: vec::map(doc.args) {|doc|
args: util::anymap(doc.args) {|doc|
{
desc: maybe_apply_op(op, doc.desc)
with doc

View File

@ -41,7 +41,7 @@ fn fold_iface(fold: fold::fold<()>, doc: doc::ifacedoc) -> doc::ifacedoc {
let doc =fold::default_seq_fold_iface(fold, doc);
{
methods: vec::map(doc.methods) {|doc|
methods: util::anymap(doc.methods) {|doc|
let (brief, desc) = modify(doc.brief, doc.desc);
{
@ -58,7 +58,7 @@ fn fold_impl(fold: fold::fold<()>, doc: doc::impldoc) -> doc::impldoc {
let doc =fold::default_seq_fold_impl(fold, doc);
{
methods: vec::map(doc.methods) {|doc|
methods: util::anymap(doc.methods) {|doc|
let (brief, desc) = modify(doc.brief, doc.desc);
{

View File

@ -112,7 +112,7 @@ fn nmoddoc_from_mod(
) -> doc::nmoddoc {
{
item: itemdoc,
fns: vec::map(module.items) {|item|
fns: util::seqmap(module.items) {|item|
let itemdoc = mk_itemdoc(item.id, item.ident);
alt item.node {
ast::native_item_fn(decl, _) {
@ -150,7 +150,7 @@ fn should_extract_fn_args() {
}
fn argdocs_from_args(args: [ast::arg]) -> [doc::argdoc] {
vec::map(args, argdoc_from_arg)
util::seqmap(args, argdoc_from_arg)
}
fn argdoc_from_arg(arg: ast::arg) -> doc::argdoc {
@ -188,7 +188,7 @@ fn enumdoc_from_enum(
fn variantdocs_from_variants(
variants: [ast::variant]
) -> [doc::variantdoc] {
vec::map(variants, variantdoc_from_variant)
util::seqmap(variants, variantdoc_from_variant)
}
fn variantdoc_from_variant(variant: ast::variant) -> doc::variantdoc {
@ -242,7 +242,7 @@ fn ifacedoc_from_iface(
) -> doc::ifacedoc {
{
item: itemdoc,
methods: vec::map(methods) {|method|
methods: util::seqmap(methods) {|method|
{
name: method.ident,
brief: none,
@ -285,7 +285,7 @@ fn impldoc_from_impl(
item: itemdoc,
iface_ty: none,
self_ty: none,
methods: vec::map(methods) {|method|
methods: util::seqmap(methods) {|method|
{
name: method.ident,
brief: none,

View File

@ -228,7 +228,7 @@ fn write_sig(ctxt: ctxt, sig: option<str>) {
fn code_block_indent(s: str) -> str {
let lines = str::lines_any(s);
let indented = vec::map(lines, { |line| #fmt(" %s", line) });
let indented = util::anymap(lines, { |line| #fmt(" %s", line) });
str::connect(indented, "\n")
}

View File

@ -105,7 +105,7 @@ fn fold_iface(
}
fn prune_methods(docs: [doc::methoddoc]) -> [doc::methoddoc] {
vec::map(docs) {|doc|
util::anymap(docs) {|doc|
{
args: prune_args(doc.args),
return: prune_return(doc.return)

View File

@ -165,7 +165,7 @@ fn get_arg_tys(srv: astsrv::srv, fn_id: doc::ast_id) -> [(str, str)] {
}
fn decl_arg_tys(decl: ast::fn_decl) -> [(str, str)] {
vec::map(decl.inputs) {|arg|
util::seqmap(decl.inputs) {|arg|
(arg.ident, pprust::ty_to_str(arg.ty))
}
}
@ -217,7 +217,7 @@ fn fold_enum(
let srv = fold.ctxt;
{
variants: vec::map(doc.variants) {|variant|
variants: util::anymap(doc.variants) {|variant|
let sig = astsrv::exec(srv) {|ctxt|
alt check ctxt.ast_map.get(doc.id()) {
ast_map::node_item(@{
@ -296,7 +296,7 @@ fn merge_methods(
item_id: doc::ast_id,
docs: [doc::methoddoc]
) -> [doc::methoddoc] {
vec::map(docs) {|doc|
util::anymap(docs) {|doc|
{
args: merge_method_arg_tys(
srv,

View File

@ -63,7 +63,7 @@ fn unindent(s: str) -> str {
if check vec::is_not_empty(lines) {
let unindented = [str::trim(vec::head(lines))]
+ vec::map(vec::tail(lines)) {|line|
+ util::anymap(vec::tail(lines)) {|line|
if str::is_whitespace(line) {
line
} else {