Keep a parent LocalDefId in SpanData.

This commit is contained in:
Camille GILLOT 2021-04-18 14:27:04 +02:00
parent 6271dedd8d
commit 127ec9a8c9
2 changed files with 8 additions and 3 deletions

View File

@ -1270,7 +1270,12 @@ impl MacroParser {
let data = delimited_span.entire().data();
(
data.hi,
Span::new(data.lo + BytePos(1), data.hi - BytePos(1), data.ctxt),
Span::new(
data.lo + BytePos(1),
data.hi - BytePos(1),
data.ctxt,
data.parent,
),
delimited_span.entire(),
)
}

View File

@ -356,11 +356,11 @@ macro_rules! source {
}
pub(crate) fn mk_sp(lo: BytePos, hi: BytePos) -> Span {
Span::new(lo, hi, SyntaxContext::root())
Span::new(lo, hi, SyntaxContext::root(), None)
}
pub(crate) fn mk_sp_lo_plus_one(lo: BytePos) -> Span {
Span::new(lo, lo + BytePos(1), SyntaxContext::root())
Span::new(lo, lo + BytePos(1), SyntaxContext::root(), None)
}
// Returns `true` if the given span does not intersect with file lines.