From 2dcc200be0f17ec0cab568736d9d3ccbae453a65 Mon Sep 17 00:00:00 2001 From: Lee Jeffery Date: Thu, 14 May 2015 18:28:28 +0100 Subject: Fix stupid mistake from previous commit --- src/libsyntax/parse/lexer/mod.rs | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) (limited to 'src/libsyntax/parse') diff --git a/src/libsyntax/parse/lexer/mod.rs b/src/libsyntax/parse/lexer/mod.rs index 1ca4451d28d..b70594a96a0 100644 --- a/src/libsyntax/parse/lexer/mod.rs +++ b/src/libsyntax/parse/lexer/mod.rs @@ -406,6 +406,11 @@ impl<'a> StringReader<'a> { // line comments starting with "///" or "//!" are doc-comments let doc_comment = self.curr_is('/') || self.curr_is('!'); + let start_bpos = if doc_comment { + self.pos - BytePos(3) + } else { + self.last_pos - BytePos(2) + }; while !self.is_eof() { match self.curr.unwrap() { @@ -425,7 +430,6 @@ impl<'a> StringReader<'a> { } return if doc_comment { - let start_bpos = self.pos - BytePos(3); self.with_str_from(start_bpos, |string| { // comments with only more "/"s are not doc comments let tok = if is_doc_comment(string) { @@ -440,7 +444,6 @@ impl<'a> StringReader<'a> { }) }) } else { - let start_bpos = self.last_pos - BytePos(2); Some(TokenAndSpan { tok: token::Comment, sp: codemap::mk_sp(start_bpos, self.last_pos) -- cgit 1.4.1-3-g733a5