about summary refs log tree commit diff
diff options
context:
space:
mode:
authorBrian Anderson <banderson@mozilla.com>2012-01-15 23:01:05 -0800
committerBrian Anderson <banderson@mozilla.com>2012-01-16 01:07:42 -0800
commit7a9ba240a07e7e9494fa53b0001282d795d1be52 (patch)
tree0a1eb8ce7d4d0b46829b9fee3e3ff5a4c4422c39
parent906a7c217454710c866f4593cecd6ba9438d5a8b (diff)
downloadrust-7a9ba240a07e7e9494fa53b0001282d795d1be52.tar.gz
rust-7a9ba240a07e7e9494fa53b0001282d795d1be52.zip
rustdoc: Rename type rustdoc to gen::ctxt
-rw-r--r--src/rustdoc/gen.rs28
-rwxr-xr-xsrc/rustdoc/rustdoc.rs15
2 files changed, 19 insertions, 24 deletions
diff --git a/src/rustdoc/gen.rs b/src/rustdoc/gen.rs
index b58287d2ce8..b6197880dcf 100644
--- a/src/rustdoc/gen.rs
+++ b/src/rustdoc/gen.rs
@@ -1,4 +1,4 @@
-type rustdoc = {
+type ctxt = {
     ps: pprust::ps,
     w: io::writer
 };
@@ -8,8 +8,8 @@ type rustdoc = {
   args(rd = "Rustdoc context",
        name = "Crate name")
 )]
-fn write_header(rd: rustdoc, name: str) {
-    rd.w.write_line("# Crate " + name);
+fn write_header(ctxt: ctxt, name: str) {
+    ctxt.w.write_line("# Crate " + name);
 }
 
 #[doc(
@@ -19,30 +19,30 @@ fn write_header(rd: rustdoc, name: str) {
        doc = "Function docs extracted from attributes",
        _fn = "AST object representing this function")
 )]
-fn write_fndoc(rd: rustdoc, ident: str, doc: doc::fndoc, decl: ast::fn_decl) {
-    rd.w.write_line("## Function `" + ident + "`");
-    rd.w.write_line(doc.brief);
+fn write_fndoc(ctxt: ctxt, ident: str, doc: doc::fndoc, decl: ast::fn_decl) {
+    ctxt.w.write_line("## Function `" + ident + "`");
+    ctxt.w.write_line(doc.brief);
     alt doc.desc {
         some(_d) {
-            rd.w.write_line("");
-            rd.w.write_line(_d);
-            rd.w.write_line("");
+            ctxt.w.write_line("");
+            ctxt.w.write_line(_d);
+            ctxt.w.write_line("");
         }
         none. { }
     }
     for arg: ast::arg in decl.inputs {
-        rd.w.write_str("### Argument `" + arg.ident + "`: ");
-        rd.w.write_line("`" + pprust::ty_to_str(arg.ty) + "`");
+        ctxt.w.write_str("### Argument `" + arg.ident + "`: ");
+        ctxt.w.write_line("`" + pprust::ty_to_str(arg.ty) + "`");
         alt doc.args.find(arg.ident) {
             some(_d) {
-                rd.w.write_line(_d);
+                ctxt.w.write_line(_d);
             }
             none. { }
         };
     }
-    rd.w.write_line("### Returns `" + pprust::ty_to_str(decl.output) + "`");
+    ctxt.w.write_line("### Returns `" + pprust::ty_to_str(decl.output) + "`");
     alt doc.return {
-        some(_r) { rd.w.write_line(_r); }
+        some(_r) { ctxt.w.write_line(_r); }
         none. { }
     }
 }
diff --git a/src/rustdoc/rustdoc.rs b/src/rustdoc/rustdoc.rs
index b7eda49d9b6..58c2519b664 100755
--- a/src/rustdoc/rustdoc.rs
+++ b/src/rustdoc/rustdoc.rs
@@ -17,23 +17,18 @@ import std::io;
 import io::writer_util;
 import std::map;
 
-type rustdoc = {
-    ps: pprust::ps,
-    w: io::writer
-};
-
 #[doc(
   brief = "Documents a single crate item.",
   args(rd = "Rustdoc context",
        item = "AST item to document")
 )]
-fn doc_item(rd: rustdoc, item: @ast::item) {
+fn doc_item(ctxt: gen::ctxt, item: @ast::item) {
     let _fndoc0 = attr_parser::parse_fn(item.ident, item.attrs);
 
     alt item.node {
         ast::item_const(ty, expr) { }
         ast::item_fn(decl, _, _) {
-            gen::write_fndoc(rd, item.ident, _fndoc0, decl);
+            gen::write_fndoc(ctxt, item.ident, _fndoc0, decl);
         }
         ast::item_mod(_mod) { }
         ast::item_ty(ty, typarams) { }
@@ -59,11 +54,11 @@ fn main(argv: [str]) {
     let crate = parse::from_file(argv[1]);
 
     let w = io::stdout();
-    let rd = { ps: pprust::rust_printer(w), w: w };
-    gen::write_header(rd, argv[1]);
+    let ctxt = { ps: pprust::rust_printer(w), w: w };
+    gen::write_header(ctxt, argv[1]);
 
     let v = visit::mk_simple_visitor(@{
-        visit_item: bind doc_item(rd, _)
+        visit_item: bind doc_item(ctxt, _)
         with *visit::default_simple_visitor()});
     visit::visit_crate(*crate, (), v);
 }