mirror of
https://github.com/rust-lang/rust.git
synced 2025-04-28 02:57:37 +00:00
mir: store the span of a scope in the ScopeData.
This commit is contained in:
parent
4e6b178649
commit
f680c623d4
@ -698,6 +698,7 @@ impl ScopeId {
|
||||
|
||||
#[derive(Clone, Debug, RustcEncodable, RustcDecodable)]
|
||||
pub struct ScopeData {
|
||||
pub span: Span,
|
||||
pub parent_scope: Option<ScopeId>,
|
||||
}
|
||||
|
||||
|
@ -298,9 +298,11 @@ macro_rules! make_mir_visitor {
|
||||
fn super_scope_data(&mut self,
|
||||
scope_data: & $($mutability)* ScopeData) {
|
||||
let ScopeData {
|
||||
ref $($mutability)* span,
|
||||
ref $($mutability)* parent_scope,
|
||||
} = *scope_data;
|
||||
|
||||
self.visit_span(span);
|
||||
if let Some(ref $($mutability)* parent_scope) = *parent_scope {
|
||||
self.visit_scope_id(parent_scope);
|
||||
}
|
||||
|
@ -255,7 +255,9 @@ impl<'a,'tcx> Builder<'a,'tcx> {
|
||||
debug!("push_scope({:?})", extent);
|
||||
let parent_id = self.scopes.last().map(|s| s.id);
|
||||
let id = ScopeId::new(self.scope_datas.len());
|
||||
let tcx = self.hir.tcx();
|
||||
self.scope_datas.push(ScopeData {
|
||||
span: extent.span(&tcx.region_maps, &tcx.map).unwrap_or(DUMMY_SP),
|
||||
parent_scope: parent_id,
|
||||
});
|
||||
self.scopes.push(Scope {
|
||||
|
Loading…
Reference in New Issue
Block a user