rustc_mir::pretty: factor out scope entry/exit annotation computation.
This commit is contained in:
parent
bfe789c044
commit
306ca4ca4f
1 changed files with 12 additions and 6 deletions
|
|
@ -106,12 +106,9 @@ enum Annotation {
|
|||
ExitScope(ScopeId),
|
||||
}
|
||||
|
||||
pub fn write_mir_fn<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>,
|
||||
src: MirSource,
|
||||
mir: &Mir<'tcx>,
|
||||
w: &mut Write,
|
||||
auxiliary: Option<&ScopeAuxiliaryVec>)
|
||||
-> io::Result<()> {
|
||||
fn scope_entry_exit_annotations(auxiliary: Option<&ScopeAuxiliaryVec>)
|
||||
-> FnvHashMap<Location, Vec<Annotation>>
|
||||
{
|
||||
// compute scope/entry exit annotations
|
||||
let mut annotations = FnvHashMap();
|
||||
if let Some(auxiliary) = auxiliary {
|
||||
|
|
@ -129,7 +126,16 @@ pub fn write_mir_fn<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>,
|
|||
}
|
||||
}
|
||||
}
|
||||
return annotations;
|
||||
}
|
||||
|
||||
pub fn write_mir_fn<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>,
|
||||
src: MirSource,
|
||||
mir: &Mir<'tcx>,
|
||||
w: &mut Write,
|
||||
auxiliary: Option<&ScopeAuxiliaryVec>)
|
||||
-> io::Result<()> {
|
||||
let annotations = scope_entry_exit_annotations(auxiliary);
|
||||
write_mir_intro(tcx, src, mir, w)?;
|
||||
for block in mir.all_basic_blocks() {
|
||||
write_basic_block(tcx, block, mir, w, &annotations)?;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue