diff options
| author | bors <bors@rust-lang.org> | 2015-04-12 09:03:04 +0000 |
|---|---|---|
| committer | bors <bors@rust-lang.org> | 2015-04-12 09:03:04 +0000 |
| commit | a1e3c25a2688664e85052b6205187b62410c0df0 (patch) | |
| tree | a9f3baed1ea1f5cef2caaa4bf20b7bef34c1c896 | |
| parent | feeb23d42e0b1bc6f0466d4c6f035cfc3a4e9718 (diff) | |
| parent | b9fa6c67fbe20bdd6a89d86d3eabe62dacb8ac5e (diff) | |
| download | rust-a1e3c25a2688664e85052b6205187b62410c0df0.tar.gz rust-a1e3c25a2688664e85052b6205187b62410c0df0.zip | |
Auto merge of #24248 - nrc:macro-span, r=sfackler
| -rw-r--r-- | src/libsyntax/parse/parser.rs | 20 |
1 files changed, 11 insertions, 9 deletions
diff --git a/src/libsyntax/parse/parser.rs b/src/libsyntax/parse/parser.rs index 3cc16006b1b..a3dd77b8197 100644 --- a/src/libsyntax/parse/parser.rs +++ b/src/libsyntax/parse/parser.rs @@ -2162,13 +2162,13 @@ impl<'a> Parser<'a> { &token::CloseDelim(delim), seq_sep_none(), |p| p.parse_token_tree())); - let hi = self.span.hi; + let hi = self.last_span.hi; return Ok(self.mk_mac_expr(lo, - hi, - MacInvocTT(pth, - tts, - EMPTY_CTXT))); + hi, + MacInvocTT(pth, + tts, + EMPTY_CTXT))); } if self.check(&token::OpenDelim(token::Brace)) { // This is a struct literal, unless we're prohibited @@ -3449,7 +3449,7 @@ impl<'a> Parser<'a> { seq_sep_none(), |p| p.parse_token_tree() )); - let hi = self.span.hi; + let hi = self.last_span.hi; let style = if delim == token::Brace { MacStmtWithBraces @@ -3567,7 +3567,7 @@ impl<'a> Parser<'a> { token::Semi => { stmts.push(P(Spanned { node: StmtMac(mac, MacStmtWithSemicolon), - span: span, + span: mk_sp(span.lo, self.span.hi), })); try!(self.bump()); } @@ -3591,7 +3591,7 @@ impl<'a> Parser<'a> { token::Semi => { stmts.push(P(Spanned { node: StmtMac(m, MacStmtWithSemicolon), - span: span, + span: mk_sp(span.lo, self.span.hi), })); try!(self.bump()); } @@ -3610,13 +3610,15 @@ impl<'a> Parser<'a> { } } _ => { // all other kinds of statements: + let mut hi = span.hi; if classify::stmt_ends_with_semi(&node) { try!(self.commit_stmt_expecting(token::Semi)); + hi = self.last_span.hi; } stmts.push(P(Spanned { node: node, - span: span + span: mk_sp(span.lo, hi) })); } } |
