fn expand_and_rename_fn_decl_and_block(fn_decl: P<ast::FnDecl>, block: P<ast::Block>,
                                       fld: &mut MacroExpander)
                                       -> (P<ast::FnDecl>, P<ast::Block>) {
    let expanded_decl = fld.fold_fn_decl(fn_decl);
    let idents = fn_decl_arg_bindings(&*expanded_decl);
    let renames =
        idents.iter().map(|id : &ast::Ident| (*id,fresh_name(id))).collect();
    // first, a renamer for the PatIdents, for the fn_decl:
    let mut rename_pat_fld = PatIdentRenamer{renames: &renames};
    let rewritten_fn_decl = rename_pat_fld.fold_fn_decl(expanded_decl);
    // now, a renamer for *all* idents, for the body:
    let mut rename_fld = IdentRenamer{renames: &renames};
    let rewritten_body = fld.fold_block(rename_fld.fold_block(block));
    (rewritten_fn_decl,rewritten_body)
}
/// Given a fn_decl and a block and a MacroExpander, expand the fn_decl, then use the
/// PatIdents in its arguments to perform renaming in the FnDecl and
/// the block, returning both the new FnDecl and the new Block.
Given a fn_decl and a block and a MacroExpander, expand the fn_decl, then use the
PatIdents in its arguments to perform renaming in the FnDecl and
the block, returning both the new FnDecl and the new Block.
Given a fn_decl and a block and a MacroExpander expand the fn_decl then use the PatIdents in its arguments to perform renaming in the FnDecl and the block returning both the new FnDecl and the new Block .
fn expand_and_rename_fn_decl_and_block(fn_decl: P<ast::FnDecl>, block: P<ast::Block>,
                                       fld: &mut MacroExpander)
                                       -> (P<ast::FnDecl>, P<ast::Block>) {
    let expanded_decl = fld.fold_fn_decl(fn_decl);
    let idents = fn_decl_arg_bindings(&*expanded_decl);
    let renames =
        idents.iter().map(|id : &ast::Ident| (*id,fresh_name(id))).collect();
    // first, a renamer for the PatIdents, for the fn_decl:
    let mut rename_pat_fld = PatIdentRenamer{renames: &renames};
    let rewritten_fn_decl = rename_pat_fld.fold_fn_decl(expanded_decl);
    // now, a renamer for *all* idents, for the body:
    let mut rename_fld = IdentRenamer{renames: &renames};
    let rewritten_body = fld.fold_block(rename_fld.fold_block(block));
    (rewritten_fn_decl,rewritten_body)
}
fn expand_and_rename_fn_decl_and_block ( fn_decl : P < ast :: FnDecl > , block : P < ast :: Block > , fld : & mut MacroExpander ) -> ( P < ast :: FnDecl > , P < ast :: Block > ) { let expanded_decl = fld . fold_fn_decl ( fn_decl ) ; let idents = fn_decl_arg_bindings ( & * expanded_decl ) ; let renames = idents . iter ( ) . map ( | id : & ast :: Ident | ( * id , fresh_name ( id ) ) ) . collect ( ) ; // first, a renamer for the PatIdents, for the fn_decl: let mut rename_pat_fld = PatIdentRenamer { renames : & renames } ; let rewritten_fn_decl = rename_pat_fld . fold_fn_decl ( expanded_decl ) ; // now, a renamer for *all* idents, for the body: let mut rename_fld = IdentRenamer { renames : & renames } ; let rewritten_body = fld . fold_block ( rename_fld . fold_block ( block ) ) ; ( rewritten_fn_decl , rewritten_body ) }
Given a fn_decl and a block and a MacroExpander, expand the fn_decl, then use the
PatIdents in its arguments to perform renaming in the FnDecl and
the block, returning both the new FnDecl and the new Block.
Given a fn_decl and a block and a MacroExpander expand the fn_decl then use the PatIdents in its arguments to perform renaming in the FnDecl and the block returning both the new FnDecl and the new Block .
fn_decl
P<ast::FnDecl>
block
P<ast::Block>
fld
&mut MacroExpander
fn_decl
P<ast::FnDecl>
block
P<ast::Block>
fld
&mut MacroExpander