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

@ -356,7 +356,7 @@ impl Clean<Generics> for ast::Generics {
pub struct Method {
pub generics: Generics,
pub self_: SelfTy,
pub purity: ast::Purity,
pub fn_style: ast::FnStyle,
pub decl: FnDecl,
}
@ -383,7 +383,7 @@ impl Clean<Item> for ast::Method {
inner: MethodItem(Method {
generics: self.generics.clean(),
self_: self.explicit_self.clean(),
purity: self.purity.clone(),
fn_style: self.fn_style.clone(),
decl: decl,
}),
}
@ -392,7 +392,7 @@ impl Clean<Item> for ast::Method {
#[deriving(Clone, Encodable, Decodable)]
pub struct TyMethod {
pub purity: ast::Purity,
pub fn_style: ast::FnStyle,
pub decl: FnDecl,
pub generics: Generics,
pub self_: SelfTy,
@ -419,7 +419,7 @@ impl Clean<Item> for ast::TypeMethod {
id: self.id,
visibility: None,
inner: TyMethodItem(TyMethod {
purity: self.purity.clone(),
fn_style: self.fn_style.clone(),
decl: decl,
self_: self.explicit_self.clean(),
generics: self.generics.clean(),
@ -451,7 +451,7 @@ impl Clean<SelfTy> for ast::ExplicitSelf {
pub struct Function {
pub decl: FnDecl,
pub generics: Generics,
pub purity: ast::Purity,
pub fn_style: ast::FnStyle,
}
impl Clean<Item> for doctree::Function {
@ -465,7 +465,7 @@ impl Clean<Item> for doctree::Function {
inner: FunctionItem(Function {
decl: self.decl.clean(),
generics: self.generics.clean(),
purity: self.purity,
fn_style: self.fn_style,
}),
}
}
@ -478,7 +478,7 @@ pub struct ClosureDecl {
pub lifetimes: Vec<Lifetime>,
pub decl: FnDecl,
pub onceness: ast::Onceness,
pub purity: ast::Purity,
pub fn_style: ast::FnStyle,
pub bounds: Vec<TyParamBound>,
}
@ -490,7 +490,7 @@ impl Clean<ClosureDecl> for ast::ClosureTy {
lifetimes: self.lifetimes.clean().move_iter().collect(),
decl: self.decl.clean(),
onceness: self.onceness,
purity: self.purity,
fn_style: self.fn_style,
bounds: match self.bounds {
Some(ref x) => x.clean().move_iter().collect(),
None => Vec::new()
@ -960,7 +960,7 @@ impl Clean<Item> for doctree::Typedef {
#[deriving(Clone, Encodable, Decodable)]
pub struct BareFunctionDecl {
pub purity: ast::Purity,
pub fn_style: ast::FnStyle,
pub generics: Generics,
pub decl: FnDecl,
pub abi: ~str,
@ -969,7 +969,7 @@ pub struct BareFunctionDecl {
impl Clean<BareFunctionDecl> for ast::BareFnTy {
fn clean(&self) -> BareFunctionDecl {
BareFunctionDecl {
purity: self.purity,
fn_style: self.fn_style,
generics: Generics {
lifetimes: self.lifetimes.clean().move_iter().collect(),
type_params: Vec::new(),
@ -1164,7 +1164,7 @@ impl Clean<Item> for ast::ForeignItem {
ForeignFunctionItem(Function {
decl: decl.clean(),
generics: generics.clean(),
purity: ast::ExternFn,
fn_style: ast::ExternFn,
})
}
ast::ForeignItemStatic(ref ty, mutbl) => {

View file

@ -113,7 +113,7 @@ pub struct Function {
pub id: NodeId,
pub name: Ident,
pub vis: ast::Visibility,
pub purity: ast::Purity,
pub fn_style: ast::FnStyle,
pub where: Span,
pub generics: ast::Generics,
}

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!()
}

View file

@ -95,7 +95,7 @@ impl<'a> RustdocVisitor<'a> {
}
pub fn visit_fn(&mut self, item: &ast::Item, fd: &ast::FnDecl,
purity: &ast::Purity, _abi: &abi::Abi,
fn_style: &ast::FnStyle, _abi: &abi::Abi,
gen: &ast::Generics) -> Function {
debug!("Visiting fn");
Function {
@ -106,7 +106,7 @@ impl<'a> RustdocVisitor<'a> {
name: item.ident,
where: item.span,
generics: gen.clone(),
purity: *purity,
fn_style: *fn_style,
}
}