1
Fork 0

Fortify dummy span checking

This commit is contained in:
Vadim Petrochenkov 2018-06-25 01:00:21 +03:00
parent 297109ea32
commit 9f92fce77c
21 changed files with 59 additions and 59 deletions

View file

@ -57,8 +57,8 @@ impl Delimited {
/// Returns the opening delimiter as a token tree.
pub fn open_tt(&self, span: Span) -> TokenTree {
let open_span = if span == DUMMY_SP {
DUMMY_SP
let open_span = if span.is_dummy() {
span
} else {
span.with_hi(span.lo() + BytePos(self.delim.len() as u32))
};
@ -67,8 +67,8 @@ impl Delimited {
/// Returns the closing delimiter as a token tree.
pub fn close_tt(&self, span: Span) -> TokenTree {
let close_span = if span == DUMMY_SP {
DUMMY_SP
let close_span = if span.is_dummy() {
span
} else {
span.with_lo(span.hi() - BytePos(self.delim.len() as u32))
};