1
Fork 0

syntax: put the correct span on doc-comments inside a module.

The position of the .bump call (before extracting the span fields) was
causing a doc-comment to have the span of the next token, not itself.
This commit is contained in:
Huon Wilson 2014-05-22 22:55:48 +10:00
parent 37bd466e58
commit d3fde8476b

View file

@ -9,7 +9,7 @@
// except according to those terms.
use ast;
use codemap::{spanned, Spanned, mk_sp};
use codemap::{spanned, Spanned, mk_sp, Span};
use parse::common::*; //resolve bug?
use parse::token;
use parse::parser::Parser;
@ -129,10 +129,10 @@ impl<'a> ParserAttr for Parser<'a> {
self.parse_attribute(true)
}
token::DOC_COMMENT(s) => {
// we need to get the position of this token before we bump.
let Span { lo, hi, .. } = self.span;
self.bump();
::attr::mk_sugared_doc_attr(self.id_to_interned_str(s),
self.span.lo,
self.span.hi)
::attr::mk_sugared_doc_attr(self.id_to_interned_str(s), lo, hi)
}
_ => {
break;