diff options
Diffstat (limited to 'src/libsyntax/codemap.rs')
| -rw-r--r-- | src/libsyntax/codemap.rs | 13 |
1 files changed, 5 insertions, 8 deletions
diff --git a/src/libsyntax/codemap.rs b/src/libsyntax/codemap.rs index 0509760120a..97d3db074bb 100644 --- a/src/libsyntax/codemap.rs +++ b/src/libsyntax/codemap.rs @@ -90,6 +90,8 @@ pub struct Span { expn_info: Option<@ExpnInfo> } +pub static DUMMY_SP: Span = Span { lo: BytePos(0), hi: BytePos(0), expn_info: None }; + #[deriving(Clone, Eq, Encodable, Decodable, IterBytes)] pub struct Spanned<T> { node: T, @@ -112,7 +114,7 @@ impl<S:Encoder> Encodable<S> for Span { impl<D:Decoder> Decodable<D> for Span { fn decode(_d: &mut D) -> Span { - dummy_sp() + DUMMY_SP } } @@ -125,7 +127,7 @@ pub fn respan<T>(sp: Span, t: T) -> Spanned<T> { } pub fn dummy_spanned<T>(t: T) -> Spanned<T> { - respan(dummy_sp(), t) + respan(DUMMY_SP, t) } /* assuming that we're not in macro expansion */ @@ -133,11 +135,6 @@ pub fn mk_sp(lo: BytePos, hi: BytePos) -> Span { Span {lo: lo, hi: hi, expn_info: None} } -// make this a const, once the compiler supports it -pub fn dummy_sp() -> Span { return mk_sp(BytePos(0), BytePos(0)); } - - - /// A source code location used for error reporting pub struct Loc { /// Information about the original source @@ -350,7 +347,7 @@ impl CodeMap { pub fn span_to_str(&self, sp: Span) -> ~str { let files = &*self.files; - if files.len() == 0 && sp == dummy_sp() { + if files.len() == 0 && sp == DUMMY_SP { return ~"no-location"; } |
