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:
parent
37bd466e58
commit
d3fde8476b
1 changed files with 4 additions and 4 deletions
|
@ -9,7 +9,7 @@
|
||||||
// except according to those terms.
|
// except according to those terms.
|
||||||
|
|
||||||
use ast;
|
use ast;
|
||||||
use codemap::{spanned, Spanned, mk_sp};
|
use codemap::{spanned, Spanned, mk_sp, Span};
|
||||||
use parse::common::*; //resolve bug?
|
use parse::common::*; //resolve bug?
|
||||||
use parse::token;
|
use parse::token;
|
||||||
use parse::parser::Parser;
|
use parse::parser::Parser;
|
||||||
|
@ -129,10 +129,10 @@ impl<'a> ParserAttr for Parser<'a> {
|
||||||
self.parse_attribute(true)
|
self.parse_attribute(true)
|
||||||
}
|
}
|
||||||
token::DOC_COMMENT(s) => {
|
token::DOC_COMMENT(s) => {
|
||||||
|
// we need to get the position of this token before we bump.
|
||||||
|
let Span { lo, hi, .. } = self.span;
|
||||||
self.bump();
|
self.bump();
|
||||||
::attr::mk_sugared_doc_attr(self.id_to_interned_str(s),
|
::attr::mk_sugared_doc_attr(self.id_to_interned_str(s), lo, hi)
|
||||||
self.span.lo,
|
|
||||||
self.span.hi)
|
|
||||||
}
|
}
|
||||||
_ => {
|
_ => {
|
||||||
break;
|
break;
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue