pub fn trans_impl(ccx: &CrateContext,
                  name: ast::Ident,
                  impl_items: &[P<hir::ImplItem>],
                  generics: &hir::Generics,
                  id: ast::NodeId) {
    let _icx = push_ctxt("meth::trans_impl");
    let tcx = ccx.tcx();

    debug!("trans_impl(name={}, id={})", name, id);

    let mut v = TransItemVisitor { ccx: ccx };

    // Both here and below with generic methods, be sure to recurse and look for
    // items that we need to translate.
    if !generics.ty_params.is_empty() {
        for impl_item in impl_items {
            match impl_item.node {
                hir::MethodImplItem(..) => {
                    visit::walk_impl_item(&mut v, impl_item);
                }
                _ => {}
            }
        }
        return;
    }
    for impl_item in impl_items {
        match impl_item.node {
            hir::MethodImplItem(ref sig, ref body) => {
                if sig.generics.ty_params.is_empty() {
                    let trans_everywhere = attr::requests_inline(&impl_item.attrs);
                    for (ref ccx, is_origin) in ccx.maybe_iter(trans_everywhere) {
                        let llfn = get_item_val(ccx, impl_item.id);
                        let empty_substs = tcx.mk_substs(Substs::trans_empty());
                        trans_fn(ccx, &sig.decl, body, llfn,
                                 empty_substs, impl_item.id, &[]);
                        update_linkage(ccx,
                                       llfn,
                                       Some(impl_item.id),
                                       if is_origin { OriginalTranslation } else { InlinedCopy });
                    }
                }
                visit::walk_impl_item(&mut v, impl_item);
            }
            _ => {}
        }
    }
}
/// The main "translation" pass for methods.  Generates code
/// for non-monomorphized methods only.  Other methods will
/// be generated once they are invoked with specific type parameters,
/// see `trans::base::lval_static_fn()` or `trans::base::monomorphic_fn()`.
The main "translation" pass for methods.  Generates code
for non-monomorphized methods only.
The main " translation " pass for methods . Generates code for non - monomorphized methods only .
pub fn trans_impl(ccx: &CrateContext,
                  name: ast::Ident,
                  impl_items: &[P<hir::ImplItem>],
                  generics: &hir::Generics,
                  id: ast::NodeId) {
    let _icx = push_ctxt("meth::trans_impl");
    let tcx = ccx.tcx();
    debug!("trans_impl(name={}, id={})", name, id);
    let mut v = TransItemVisitor { ccx: ccx };
    // Both here and below with generic methods, be sure to recurse and look for
    // items that we need to translate.
    if !generics.ty_params.is_empty() {
        for impl_item in impl_items {
            match impl_item.node {
                hir::MethodImplItem(..) => {
                    visit::walk_impl_item(&mut v, impl_item);
                }
                _ => {}
            }
        }
        return;
    }
    for impl_item in impl_items {
        match impl_item.node {
            hir::MethodImplItem(ref sig, ref body) => {
                if sig.generics.ty_params.is_empty() {
                    let trans_everywhere = attr::requests_inline(&impl_item.attrs);
                    for (ref ccx, is_origin) in ccx.maybe_iter(trans_everywhere) {
                        let llfn = get_item_val(ccx, impl_item.id);
                        let empty_substs = tcx.mk_substs(Substs::trans_empty());
                        trans_fn(ccx, &sig.decl, body, llfn,
                                 empty_substs, impl_item.id, &[]);
                        update_linkage(ccx,
                                       llfn,
                                       Some(impl_item.id),
                                       if is_origin { OriginalTranslation } else { InlinedCopy });
                    }
                }
                visit::walk_impl_item(&mut v, impl_item);
            }
            _ => {}
        }
    }
}
pub fn trans_impl ( ccx : & CrateContext , name : ast :: Ident , impl_items : & [ P < hir :: ImplItem > ] , generics : & hir :: Generics , id : ast :: NodeId ) { let _icx = push_ctxt ( " " ) ; let tcx = ccx . tcx ( ) ; debug ! ( " " name id ) ; let mut v = TransItemVisitor { ccx : ccx } ; // Both here and below with generic methods, be sure to recurse and look for // items that we need to translate. if ! generics . ty_params . is_empty ( ) { for impl_item in impl_items { match impl_item . node { hir :: MethodImplItem ( .. ) => { visit :: walk_impl_item ( & mut v , impl_item ) ; } _ => { } } } return ; } for impl_item in impl_items { match impl_item . node { hir :: MethodImplItem ( ref sig , ref body ) => { if sig . generics . ty_params . is_empty ( ) { let trans_everywhere = attr :: requests_inline ( & impl_item . attrs ) ; for ( ref ccx , is_origin ) in ccx . maybe_iter ( trans_everywhere ) { let llfn = get_item_val ( ccx , impl_item . id ) ; let empty_substs = tcx . mk_substs ( Substs :: trans_empty ( ) ) ; trans_fn ( ccx , & sig . decl , body , llfn , empty_substs , impl_item . id , & [ ] ) ; update_linkage ( ccx , llfn , Some ( impl_item . id ) , if is_origin { OriginalTranslation } else { InlinedCopy } ) ; } } visit :: walk_impl_item ( & mut v , impl_item ) ; } _ => { } } } }
The main "translation" pass for methods.
The main " translation " pass for methods .
ccx
&CrateContext
name
ast::Ident
impl_items
&[P<hir::ImplItem>]
generics
&hir::Generics
id
ast::NodeId
ccx
&CrateContext
name
ast::Ident
impl_items
&[P<hir::ImplItem>]
generics
&hir::Generics
id
ast::NodeId