parser: Do not override syntactic context for dummy spans

This commit is contained in:
Vadim Petrochenkov
2018-04-22 04:10:15 +03:00
parent aa7ce896f2
commit 6a4e0b3fae
3 changed files with 55 additions and 1 deletions

View File

@@ -589,7 +589,8 @@ impl<'a> Parser<'a> {
self.token_cursor.next()
};
if next.sp == syntax_pos::DUMMY_SP {
next.sp = self.prev_span;
// Tweak the location for better diagnostics, but keep syntactic context intact.
next.sp = self.prev_span.with_ctxt(next.sp.ctxt());
}
next
}