Renamed ast::Purity to ast::FnStyle and ast::ImpureFn to ast::NormalFn and updated associated variable and function names.

This commit is contained in:
Kasey Carrothers 2014-04-06 18:04:40 -07:00 committed by Alex Crichton
parent 3f2c55f7d5
commit 0bf4e900d4
40 changed files with 262 additions and 262 deletions

View file

@ -29,9 +29,9 @@ use html::render::{cache_key, current_location_key};
/// Helper to render an optional visibility with a space after it (if the
/// visibility is preset)
pub struct VisSpace(pub Option<ast::Visibility>);
/// Similarly to VisSpace, this structure is used to render a purity with a
/// Similarly to VisSpace, this structure is used to render a function style with a
/// space after it.
pub struct PuritySpace(pub ast::Purity);
pub struct FnStyleSpace(pub ast::FnStyle);
/// Wrapper struct for properly emitting a method declaration.
pub struct Method<'a>(pub &'a clean::SelfTy, pub &'a clean::FnDecl);
@ -41,9 +41,9 @@ impl VisSpace {
}
}
impl PuritySpace {
pub fn get(&self) -> ast::Purity {
let PuritySpace(v) = *self; v
impl FnStyleSpace {
pub fn get(&self) -> ast::FnStyle {
let FnStyleSpace(v) = *self; v
}
}
@ -343,7 +343,7 @@ impl fmt::Show for clean::Type {
};
write!(f.buf, "{}{}{arrow, select, yes{ -&gt; {ret}} other{}}",
PuritySpace(decl.purity),
FnStyleSpace(decl.fn_style),
match decl.sigil {
ast::OwnedSigil => format!("proc({})", decl.decl.inputs),
ast::BorrowedSigil => format!("{}|{}|", region, decl.decl.inputs),
@ -355,7 +355,7 @@ impl fmt::Show for clean::Type {
}
clean::BareFunction(ref decl) => {
write!(f.buf, "{}{}fn{}{}",
PuritySpace(decl.purity),
FnStyleSpace(decl.fn_style),
match decl.abi {
ref x if "" == *x => ~"",
ref x if "\"Rust\"" == *x => ~"",
@ -472,12 +472,12 @@ impl fmt::Show for VisSpace {
}
}
impl fmt::Show for PuritySpace {
impl fmt::Show for FnStyleSpace {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
match self.get() {
ast::UnsafeFn => write!(f.buf, "unsafe "),
ast::ExternFn => write!(f.buf, "extern "),
ast::ImpureFn => Ok(())
ast::NormalFn => Ok(())
}
}
}

View file

@ -51,7 +51,7 @@ use rustc::util::nodemap::NodeSet;
use clean;
use doctree;
use fold::DocFolder;
use html::format::{VisSpace, Method, PuritySpace};
use html::format::{VisSpace, Method, FnStyleSpace};
use html::layout;
use html::markdown;
use html::markdown::Markdown;
@ -1191,10 +1191,10 @@ fn item_module(w: &mut Writer, cx: &Context,
fn item_function(w: &mut Writer, it: &clean::Item,
f: &clean::Function) -> fmt::Result {
try!(write!(w, "<pre class='rust fn'>{vis}{purity}fn \
try!(write!(w, "<pre class='rust fn'>{vis}{fn_style}fn \
{name}{generics}{decl}</pre>",
vis = VisSpace(it.visibility),
purity = PuritySpace(f.purity),
fn_style = FnStyleSpace(f.fn_style),
name = it.name.get_ref().as_slice(),
generics = f.generics,
decl = f.decl));
@ -1305,12 +1305,12 @@ fn item_trait(w: &mut Writer, it: &clean::Item,
}
fn render_method(w: &mut Writer, meth: &clean::Item) -> fmt::Result {
fn fun(w: &mut Writer, it: &clean::Item, purity: ast::Purity,
fn fun(w: &mut Writer, it: &clean::Item, fn_style: ast::FnStyle,
g: &clean::Generics, selfty: &clean::SelfTy,
d: &clean::FnDecl) -> fmt::Result {
write!(w, "{}fn <a href='\\#{ty}.{name}' class='fnname'>{name}</a>\
{generics}{decl}",
match purity {
match fn_style {
ast::UnsafeFn => "unsafe ",
_ => "",
},
@ -1321,10 +1321,10 @@ fn render_method(w: &mut Writer, meth: &clean::Item) -> fmt::Result {
}
match meth.inner {
clean::TyMethodItem(ref m) => {
fun(w, meth, m.purity, &m.generics, &m.self_, &m.decl)
fun(w, meth, m.fn_style, &m.generics, &m.self_, &m.decl)
}
clean::MethodItem(ref m) => {
fun(w, meth, m.purity, &m.generics, &m.self_, &m.decl)
fun(w, meth, m.fn_style, &m.generics, &m.self_, &m.decl)
}
_ => unreachable!()
}