fn expand_non_macro_stmt(stmt: Stmt, fld: &mut MacroExpander)
                         -> SmallVector<Stmt> {
    // is it a let?
    match stmt.node {
        StmtKind::Local(local) => {
            // take it apart:
            let rewritten_local = local.map(|Local {id, pat, ty, init, span, attrs}| {
                // expand the ty since TyKind::FixedLengthVec contains an Expr
                // and thus may have a macro use
                let expanded_ty = ty.map(|t| fld.fold_ty(t));
                // expand the pat (it might contain macro uses):
                let expanded_pat = fld.fold_pat(pat);
                // find the PatIdents in the pattern:
                // oh dear heaven... this is going to include the enum
                // names, as well... but that should be okay, as long as
                // the new names are gensyms for the old ones.
                // generate fresh names, push them to a new pending list
                let idents = pattern_bindings(&expanded_pat);
                let mut new_pending_renames =
                    idents.iter().map(|ident| (*ident, fresh_name(*ident))).collect();
                // rewrite the pattern using the new names (the old
                // ones have already been applied):
                let rewritten_pat = {
                    // nested binding to allow borrow to expire:
                    let mut rename_fld = IdentRenamer{renames: &mut new_pending_renames};
                    rename_fld.fold_pat(expanded_pat)
                };
                // add them to the existing pending renames:
                fld.cx.syntax_env.info().pending_renames
                      .extend(new_pending_renames);
                Local {
                    id: id,
                    ty: expanded_ty,
                    pat: rewritten_pat,
                    // also, don't forget to expand the init:
                    init: init.map(|e| fld.fold_expr(e)),
                    span: span,
                    attrs: fold::fold_thin_attrs(attrs, fld),
                }
            });
            SmallVector::one(Stmt {
                id: stmt.id,
                node: StmtKind::Local(rewritten_local),
                span: stmt.span,
            })
        }
        _ => noop_fold_stmt(stmt, fld),
    }
}
// expand a non-macro stmt. this is essentially the fallthrough for
// expand_stmt, above.
expand a non-macro stmt. this is essentially the fallthrough for
expand_stmt, above.
expand a non - macro stmt . this is essentially the fallthrough for expand_stmt above .
fn expand_non_macro_stmt(stmt: Stmt, fld: &mut MacroExpander)
                         -> SmallVector<Stmt> {
    // is it a let?
    match stmt.node {
        StmtKind::Local(local) => {
            // take it apart:
            let rewritten_local = local.map(|Local {id, pat, ty, init, span, attrs}| {
                // expand the ty since TyKind::FixedLengthVec contains an Expr
                // and thus may have a macro use
                let expanded_ty = ty.map(|t| fld.fold_ty(t));
                // expand the pat (it might contain macro uses):
                let expanded_pat = fld.fold_pat(pat);
                // find the PatIdents in the pattern:
                // oh dear heaven... this is going to include the enum
                // names, as well... but that should be okay, as long as
                // the new names are gensyms for the old ones.
                // generate fresh names, push them to a new pending list
                let idents = pattern_bindings(&expanded_pat);
                let mut new_pending_renames =
                    idents.iter().map(|ident| (*ident, fresh_name(*ident))).collect();
                // rewrite the pattern using the new names (the old
                // ones have already been applied):
                let rewritten_pat = {
                    // nested binding to allow borrow to expire:
                    let mut rename_fld = IdentRenamer{renames: &mut new_pending_renames};
                    rename_fld.fold_pat(expanded_pat)
                };
                // add them to the existing pending renames:
                fld.cx.syntax_env.info().pending_renames
                      .extend(new_pending_renames);
                Local {
                    id: id,
                    ty: expanded_ty,
                    pat: rewritten_pat,
                    // also, don't forget to expand the init:
                    init: init.map(|e| fld.fold_expr(e)),
                    span: span,
                    attrs: fold::fold_thin_attrs(attrs, fld),
                }
            });
            SmallVector::one(Stmt {
                id: stmt.id,
                node: StmtKind::Local(rewritten_local),
                span: stmt.span,
            })
        }
        _ => noop_fold_stmt(stmt, fld),
    }
}
fn expand_non_macro_stmt ( stmt : Stmt , fld : & mut MacroExpander ) -> SmallVector < Stmt > { // is it a let? match stmt . node { StmtKind :: Local ( local ) => { // take it apart: let rewritten_local = local . map ( | Local { id , pat , ty , init , span , attrs } | { // expand the ty since TyKind::FixedLengthVec contains an Expr // and thus may have a macro use let expanded_ty = ty . map ( | t | fld . fold_ty ( t ) ) ; // expand the pat (it might contain macro uses): let expanded_pat = fld . fold_pat ( pat ) ; // find the PatIdents in the pattern: // oh dear heaven... this is going to include the enum // names, as well... but that should be okay, as long as // the new names are gensyms for the old ones. // generate fresh names, push them to a new pending list let idents = pattern_bindings ( & expanded_pat ) ; let mut new_pending_renames = idents . iter ( ) . map ( | ident | ( * ident , fresh_name ( * ident ) ) ) . collect ( ) ; // rewrite the pattern using the new names (the old // ones have already been applied): let rewritten_pat = { // nested binding to allow borrow to expire: let mut rename_fld = IdentRenamer { renames : & mut new_pending_renames } ; rename_fld . fold_pat ( expanded_pat ) } ; // add them to the existing pending renames: fld . cx . syntax_env . info ( ) . pending_renames . extend ( new_pending_renames ) ; Local { id : id , ty : expanded_ty , pat : rewritten_pat , // also, don't forget to expand the init: init : init . map ( | e | fld . fold_expr ( e ) ) , span : span , attrs : fold :: fold_thin_attrs ( attrs , fld ) , } } ) ; SmallVector :: one ( Stmt { id : stmt . id , node : StmtKind :: Local ( rewritten_local ) , span : stmt . span , } ) } _ => noop_fold_stmt ( stmt , fld ) , } }
expand a non-macro stmt.
expand a non - macro stmt .
stmt
Stmt
fld
&mut MacroExpander
stmt
Stmt
fld
&mut MacroExpander