pub fn decode_inlined_item<'tcx>(cdata: &cstore::crate_metadata,
                                 tcx: &ty::ctxt<'tcx>,
                                 path: Vec<ast_map::PathElem>,
                                 par_doc: rbml::Doc)
                                 -> Result<&'tcx ast::InlinedItem, Vec<ast_map::PathElem>> {
    match par_doc.opt_child(c::tag_ast) {
      None => Err(path),
      Some(ast_doc) => {
        let mut path_as_str = None;
        debug!("> Decoding inlined fn: {:?}::?",
        {
            // Do an Option dance to use the path after it is moved below.
            let s = ast_map::path_to_string(path.iter().cloned());
            path_as_str = Some(s);
            path_as_str.as_ref().map(|x| &x[..])
        });
        let mut ast_dsr = reader::Decoder::new(ast_doc);
        let from_id_range = Decodable::decode(&mut ast_dsr).unwrap();
        let to_id_range = reserve_id_range(&tcx.sess, from_id_range);
        let dcx = &DecodeContext {
            cdata: cdata,
            tcx: tcx,
            from_id_range: from_id_range,
            to_id_range: to_id_range,
            last_filemap_index: Cell::new(0)
        };
        let raw_ii = decode_ast(ast_doc);
        let ii = ast_map::map_decoded_item(&dcx.tcx.map, path, raw_ii, dcx);

        let ident = match *ii {
            ast::IIItem(ref i) => i.ident,
            ast::IIForeign(ref i) => i.ident,
            ast::IITraitItem(_, ref ti) => ti.ident,
            ast::IIImplItem(_, ref ii) => ii.ident
        };
        debug!("Fn named: {}", token::get_ident(ident));
        debug!("< Decoded inlined fn: {}::{}",
               path_as_str.unwrap(),
               token::get_ident(ident));
        region::resolve_inlined_item(&tcx.sess, &tcx.region_maps, ii);
        decode_side_tables(dcx, ast_doc);
        match *ii {
          ast::IIItem(ref i) => {
            debug!(">>> DECODED ITEM >>>\n{}\n<<< DECODED ITEM <<<",
                   syntax::print::pprust::item_to_string(&**i));
          }
          _ => { }
        }
        Ok(ii)
      }
    }
}
/// Decodes an item from its AST in the cdata's metadata and adds it to the
/// ast-map.
Decodes an item from its AST in the cdata's metadata and adds it to the
ast-map.
Decodes an item from its AST in the cdata ' s metadata and adds it to the ast - map .
pub fn decode_inlined_item<'tcx>(cdata: &cstore::crate_metadata,
                                 tcx: &ty::ctxt<'tcx>,
                                 path: Vec<ast_map::PathElem>,
                                 par_doc: rbml::Doc)
                                 -> Result<&'tcx ast::InlinedItem, Vec<ast_map::PathElem>> {
    match par_doc.opt_child(c::tag_ast) {
      None => Err(path),
      Some(ast_doc) => {
        let mut path_as_str = None;
        debug!("> Decoding inlined fn: {:?}::?",
        {
            // Do an Option dance to use the path after it is moved below.
            let s = ast_map::path_to_string(path.iter().cloned());
            path_as_str = Some(s);
            path_as_str.as_ref().map(|x| &x[..])
        });
        let mut ast_dsr = reader::Decoder::new(ast_doc);
        let from_id_range = Decodable::decode(&mut ast_dsr).unwrap();
        let to_id_range = reserve_id_range(&tcx.sess, from_id_range);
        let dcx = &DecodeContext {
            cdata: cdata,
            tcx: tcx,
            from_id_range: from_id_range,
            to_id_range: to_id_range,
            last_filemap_index: Cell::new(0)
        };
        let raw_ii = decode_ast(ast_doc);
        let ii = ast_map::map_decoded_item(&dcx.tcx.map, path, raw_ii, dcx);
        let ident = match *ii {
            ast::IIItem(ref i) => i.ident,
            ast::IIForeign(ref i) => i.ident,
            ast::IITraitItem(_, ref ti) => ti.ident,
            ast::IIImplItem(_, ref ii) => ii.ident
        };
        debug!("Fn named: {}", token::get_ident(ident));
        debug!("< Decoded inlined fn: {}::{}",
               path_as_str.unwrap(),
               token::get_ident(ident));
        region::resolve_inlined_item(&tcx.sess, &tcx.region_maps, ii);
        decode_side_tables(dcx, ast_doc);
        match *ii {
          ast::IIItem(ref i) => {
            debug!(">>> DECODED ITEM >>>\n{}\n<<< DECODED ITEM <<<",
                   syntax::print::pprust::item_to_string(&**i));
          }
          _ => { }
        }
        Ok(ii)
      }
    }
}
pub fn decode_inlined_item < ' tcx > ( cdata : & cstore :: crate_metadata , tcx : & ty :: ctxt < ' tcx > , path : Vec < ast_map :: PathElem > , par_doc : rbml :: Doc ) -> Result < & ' tcx ast :: InlinedItem , Vec < ast_map :: PathElem > > { match par_doc . opt_child ( c :: tag_ast ) { None => Err ( path ) , Some ( ast_doc ) => { let mut path_as_str = None ; debug ! ( " " { // Do an Option dance to use the path after it is moved below. let s ast_map path_to_string ( path iter ( ) cloned ( ) ) path_as_str Some ( s ) path_as_str as_ref ( ) map ( x x [ ] ) } ) ; let mut ast_dsr = reader :: Decoder :: new ( ast_doc ) ; let from_id_range = Decodable :: decode ( & mut ast_dsr ) . unwrap ( ) ; let to_id_range = reserve_id_range ( & tcx . sess , from_id_range ) ; let dcx = & DecodeContext { cdata : cdata , tcx : tcx , from_id_range : from_id_range , to_id_range : to_id_range , last_filemap_index : Cell :: new ( 0 ) } ; let raw_ii = decode_ast ( ast_doc ) ; let ii = ast_map :: map_decoded_item ( & dcx . tcx . map , path , raw_ii , dcx ) ; let ident = match * ii { ast :: IIItem ( ref i ) => i . ident , ast :: IIForeign ( ref i ) => i . ident , ast :: IITraitItem ( _ , ref ti ) => ti . ident , ast :: IIImplItem ( _ , ref ii ) => ii . ident } ; debug ! ( " " token get_ident ( ident ) ) ; debug ! ( " " path_as_str unwrap ( ) token get_ident ( ident ) ) ; region :: resolve_inlined_item ( & tcx . sess , & tcx . region_maps , ii ) ; decode_side_tables ( dcx , ast_doc ) ; match * ii { ast :: IIItem ( ref i ) => { debug ! ( " \n \n " syntax print pprust item_to_string ( i ) ) ; } _ => { } } Ok ( ii ) } } }
Decodes an item from its AST in the cdata's metadata and adds it to the
ast-map.
Decodes an item from its AST in the cdata ' s metadata and adds it to the ast - map .
cdata
&cstore::crate_metadata
tcx
&ty::ctxt<'tcx>
path
Vec<ast_map::PathElem>
par_doc
rbml::Doc