diff options
Diffstat (limited to 'src/locators/source.rs')
-rw-r--r-- | src/locators/source.rs | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/src/locators/source.rs b/src/locators/source.rs index 6837133..7e5abd2 100644 --- a/src/locators/source.rs +++ b/src/locators/source.rs @@ -9,12 +9,19 @@ pub struct SourceSpan { pub in_merged: SourceLocation, /// The location of this span in the original source file. pub in_source: Option<SourceLocation>, + /// Drill down to a more accurate location. + pub child: Option<Box<SourceSpan>>, } impl SourceSpan { pub fn location(&self) -> &SourceLocation { self.in_source.as_ref().unwrap_or(&self.in_merged) } + + /// Wrap this source span around a child source span. + pub fn wrap(mut self, source: SourceSpan) -> Self { + self.child = Some(Box::new(source)); self + } } |