pub fn trans_local_var<'blk, 'tcx>(bcx: Block<'blk, 'tcx>,
                                   def: def::Def)
                                   -> Datum<'tcx, Lvalue> {
    let _icx = push_ctxt("trans_local_var");

    match def {
        def::DefUpvar(nid, _) => {
            // Can't move upvars, so this is never a ZeroMemLastUse.
            let local_ty = node_id_type(bcx, nid);
            match bcx.fcx.llupvars.borrow().get(&nid) {
                Some(&val) => Datum::new(val, local_ty, Lvalue),
                None => {
                    bcx.sess().bug(&format!(
                        "trans_local_var: no llval for upvar {} found",
                        nid));
                }
            }
        }
        def::DefLocal(nid) => {
            let datum = match bcx.fcx.lllocals.borrow().get(&nid) {
                Some(&v) => v,
                None => {
                    bcx.sess().bug(&format!(
                        "trans_local_var: no datum for local/arg {} found",
                        nid));
                }
            };
            debug!("take_local(nid={}, v={}, ty={})",
                   nid, bcx.val_to_string(datum.val), datum.ty);
            datum
        }
        _ => {
            bcx.sess().unimpl(&format!(
                "unsupported def type in trans_local_var: {:?}",
                def));
        }
    }
}
/// Translates a reference to a local variable or argument. This always results in an lvalue datum.
Translates a reference to a local variable or argument. This always results in an lvalue datum.
Translates a reference to a local variable or argument . This always results in an lvalue datum .
pub fn trans_local_var<'blk, 'tcx>(bcx: Block<'blk, 'tcx>,
                                   def: def::Def)
                                   -> Datum<'tcx, Lvalue> {
    let _icx = push_ctxt("trans_local_var");
    match def {
        def::DefUpvar(nid, _) => {
            // Can't move upvars, so this is never a ZeroMemLastUse.
            let local_ty = node_id_type(bcx, nid);
            match bcx.fcx.llupvars.borrow().get(&nid) {
                Some(&val) => Datum::new(val, local_ty, Lvalue),
                None => {
                    bcx.sess().bug(&format!(
                        "trans_local_var: no llval for upvar {} found",
                        nid));
                }
            }
        }
        def::DefLocal(nid) => {
            let datum = match bcx.fcx.lllocals.borrow().get(&nid) {
                Some(&v) => v,
                None => {
                    bcx.sess().bug(&format!(
                        "trans_local_var: no datum for local/arg {} found",
                        nid));
                }
            };
            debug!("take_local(nid={}, v={}, ty={})",
                   nid, bcx.val_to_string(datum.val), datum.ty);
            datum
        }
        _ => {
            bcx.sess().unimpl(&format!(
                "unsupported def type in trans_local_var: {:?}",
                def));
        }
    }
}
pub fn trans_local_var < ' blk , ' tcx > ( bcx : Block < ' blk , ' tcx > , def : def :: Def ) -> Datum < ' tcx , Lvalue > { let _icx = push_ctxt ( " " ) ; match def { def :: DefUpvar ( nid , _ ) => { // Can't move upvars, so this is never a ZeroMemLastUse. let local_ty = node_id_type ( bcx , nid ) ; match bcx . fcx . llupvars . borrow ( ) . get ( & nid ) { Some ( & val ) => Datum :: new ( val , local_ty , Lvalue ) , None => { bcx . sess ( ) . bug ( & format ! ( " " nid ) ) ; } } } def :: DefLocal ( nid ) => { let datum = match bcx . fcx . lllocals . borrow ( ) . get ( & nid ) { Some ( & v ) => v , None => { bcx . sess ( ) . bug ( & format ! ( " " nid ) ) ; } } ; debug ! ( " " nid bcx val_to_string ( datum val ) datum ty ) ; datum } _ => { bcx . sess ( ) . unimpl ( & format ! ( " " def ) ) ; } } }
Translates a reference to a local variable or argument.
Translates a reference to a local variable or argument .
bcx
Block<'blk, 'tcx>
def
def::Def
bcx
Block<'blk, 'tcx>
def
def::Def