Fix spans for macros
This commit is contained in:
parent
c87ec1edb1
commit
b9fa6c67fb
1 changed files with 11 additions and 9 deletions
|
@ -2162,13 +2162,13 @@ impl<'a> Parser<'a> {
|
||||||
&token::CloseDelim(delim),
|
&token::CloseDelim(delim),
|
||||||
seq_sep_none(),
|
seq_sep_none(),
|
||||||
|p| p.parse_token_tree()));
|
|p| p.parse_token_tree()));
|
||||||
let hi = self.span.hi;
|
let hi = self.last_span.hi;
|
||||||
|
|
||||||
return Ok(self.mk_mac_expr(lo,
|
return Ok(self.mk_mac_expr(lo,
|
||||||
hi,
|
hi,
|
||||||
MacInvocTT(pth,
|
MacInvocTT(pth,
|
||||||
tts,
|
tts,
|
||||||
EMPTY_CTXT)));
|
EMPTY_CTXT)));
|
||||||
}
|
}
|
||||||
if self.check(&token::OpenDelim(token::Brace)) {
|
if self.check(&token::OpenDelim(token::Brace)) {
|
||||||
// This is a struct literal, unless we're prohibited
|
// This is a struct literal, unless we're prohibited
|
||||||
|
@ -3449,7 +3449,7 @@ impl<'a> Parser<'a> {
|
||||||
seq_sep_none(),
|
seq_sep_none(),
|
||||||
|p| p.parse_token_tree()
|
|p| p.parse_token_tree()
|
||||||
));
|
));
|
||||||
let hi = self.span.hi;
|
let hi = self.last_span.hi;
|
||||||
|
|
||||||
let style = if delim == token::Brace {
|
let style = if delim == token::Brace {
|
||||||
MacStmtWithBraces
|
MacStmtWithBraces
|
||||||
|
@ -3567,7 +3567,7 @@ impl<'a> Parser<'a> {
|
||||||
token::Semi => {
|
token::Semi => {
|
||||||
stmts.push(P(Spanned {
|
stmts.push(P(Spanned {
|
||||||
node: StmtMac(mac, MacStmtWithSemicolon),
|
node: StmtMac(mac, MacStmtWithSemicolon),
|
||||||
span: span,
|
span: mk_sp(span.lo, self.span.hi),
|
||||||
}));
|
}));
|
||||||
try!(self.bump());
|
try!(self.bump());
|
||||||
}
|
}
|
||||||
|
@ -3591,7 +3591,7 @@ impl<'a> Parser<'a> {
|
||||||
token::Semi => {
|
token::Semi => {
|
||||||
stmts.push(P(Spanned {
|
stmts.push(P(Spanned {
|
||||||
node: StmtMac(m, MacStmtWithSemicolon),
|
node: StmtMac(m, MacStmtWithSemicolon),
|
||||||
span: span,
|
span: mk_sp(span.lo, self.span.hi),
|
||||||
}));
|
}));
|
||||||
try!(self.bump());
|
try!(self.bump());
|
||||||
}
|
}
|
||||||
|
@ -3610,13 +3610,15 @@ impl<'a> Parser<'a> {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
_ => { // all other kinds of statements:
|
_ => { // all other kinds of statements:
|
||||||
|
let mut hi = span.hi;
|
||||||
if classify::stmt_ends_with_semi(&node) {
|
if classify::stmt_ends_with_semi(&node) {
|
||||||
try!(self.commit_stmt_expecting(token::Semi));
|
try!(self.commit_stmt_expecting(token::Semi));
|
||||||
|
hi = self.last_span.hi;
|
||||||
}
|
}
|
||||||
|
|
||||||
stmts.push(P(Spanned {
|
stmts.push(P(Spanned {
|
||||||
node: node,
|
node: node,
|
||||||
span: span
|
span: mk_sp(span.lo, hi)
|
||||||
}));
|
}));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue