Creates a new `RelSourceLoc` based on the given base and offset.
(base: SourceLoc, offset: SourceLoc)
| 64 | |
| 65 | /// Creates a new `RelSourceLoc` based on the given base and offset. |
| 66 | pub fn from_base_offset(base: SourceLoc, offset: SourceLoc) -> Self { |
| 67 | if base.is_default() || offset.is_default() { |
| 68 | Self::default() |
| 69 | } else { |
| 70 | Self(offset.bits().wrapping_sub(base.bits())) |
| 71 | } |
| 72 | } |
| 73 | |
| 74 | /// Expands the relative source location into an absolute one, using the given base. |
| 75 | pub fn expand(&self, base: SourceLoc) -> SourceLoc { |
nothing calls this directly
no test coverage detected