Replace dummy spans with empty spans

This commit is contained in:
Seiichi Uchida
2018-02-04 21:19:14 +09:00
parent d6bdf296a4
commit b5099a708d
16 changed files with 32 additions and 25 deletions

View File

@@ -216,6 +216,12 @@ impl Span {
self.data().with_ctxt(ctxt)
}
/// Returns a new span representing an empty span at the beginning of this span
#[inline]
pub fn empty(self) -> Span {
span.with_hi(self.lo())
}
/// Returns `self` if `self` is not the dummy span, and `other` otherwise.
pub fn substitute_dummy(self, other: Span) -> Span {
if self.source_equal(&DUMMY_SP) { other } else { self }