File tree 2 files changed +18
-11
lines changed
2 files changed +18
-11
lines changed Original file line number Diff line number Diff line change @@ -510,10 +510,6 @@ impl SpanData {
510
510
pub fn is_dummy ( self ) -> bool {
511
511
self . lo . 0 == 0 && self . hi . 0 == 0
512
512
}
513
- #[ inline]
514
- pub fn is_visible ( self , sm : & SourceMap ) -> bool {
515
- !self . is_dummy ( ) && sm. is_span_accessible ( self . span ( ) )
516
- }
517
513
/// Returns `true` if `self` fully encloses `other`.
518
514
pub fn contains ( self , other : Self ) -> bool {
519
515
self . lo <= other. lo && other. hi <= self . hi
@@ -573,15 +569,9 @@ impl Span {
573
569
self . data ( ) . with_parent ( ctxt)
574
570
}
575
571
576
- /// Returns `true` if this is a dummy span with any hygienic context.
577
- #[ inline]
578
- pub fn is_dummy ( self ) -> bool {
579
- self . data_untracked ( ) . is_dummy ( )
580
- }
581
-
582
572
#[ inline]
583
573
pub fn is_visible ( self , sm : & SourceMap ) -> bool {
584
- self . data_untracked ( ) . is_visible ( sm )
574
+ ! self . is_dummy ( ) && sm . is_span_accessible ( self )
585
575
}
586
576
587
577
/// Returns `true` if this span comes from any kind of macro, desugaring or inlining.
Original file line number Diff line number Diff line change @@ -193,6 +193,23 @@ impl Span {
193
193
}
194
194
}
195
195
196
+ /// Returns `true` if this is a dummy span with any hygienic context.
197
+ #[ inline]
198
+ pub fn is_dummy ( self ) -> bool {
199
+ if self . len_with_tag_or_marker != BASE_LEN_INTERNED_MARKER {
200
+ // Inline-context or inline-parent format.
201
+ let lo = self . lo_or_index ;
202
+ let len = ( self . len_with_tag_or_marker & !PARENT_TAG ) as u32 ;
203
+ debug_assert ! ( len <= MAX_LEN ) ;
204
+ lo == 0 && len == 0
205
+ } else {
206
+ // Fully-interned or partially-interned format.
207
+ let index = self . lo_or_index ;
208
+ let data = with_span_interner ( |interner| interner. spans [ index as usize ] ) ;
209
+ data. lo == BytePos ( 0 ) && data. hi == BytePos ( 0 )
210
+ }
211
+ }
212
+
196
213
/// This function is used as a fast path when decoding the full `SpanData` is not necessary.
197
214
/// It's a cut-down version of `data_untracked`.
198
215
#[ inline]
You can’t perform that action at this time.
0 commit comments