create localdecl and add span to it

This commit is contained in:
ouz-a 2023-09-30 16:40:15 +03:00
parent 5282e5e120
commit 9130484db9
2 changed files with 15 additions and 2 deletions

View File

@ -106,7 +106,14 @@ fn mir_body(&mut self, item: stable_mir::DefId) -> stable_mir::mir::Body {
.collect(),
})
.collect(),
locals: mir.local_decls.iter().map(|decl| self.intern_ty(decl.ty)).collect(),
locals: mir
.local_decls
.iter()
.map(|decl| stable_mir::mir::LocalDecl {
ty: self.intern_ty(decl.ty),
span: decl.source_info.span.stable(self),
})
.collect(),
}
}

View File

@ -5,7 +5,13 @@
#[derive(Clone, Debug)]
pub struct Body {
pub blocks: Vec<BasicBlock>,
pub locals: Vec<Ty>,
pub locals: Vec<LocalDecl>,
}
#[derive(Clone, Debug)]
pub struct LocalDecl {
pub ty: Ty,
pub span: Span,
}
#[derive(Clone, Debug)]