]> git.lizzy.rs Git - rust.git/commitdiff
Tweak identifer lexing.
authorNicholas Nethercote <nnethercote@mozilla.com>
Thu, 31 May 2018 00:52:29 +0000 (10:52 +1000)
committerNicholas Nethercote <nnethercote@mozilla.com>
Thu, 31 May 2018 06:04:33 +0000 (16:04 +1000)
By calling `bump()` after getting the first char, to avoid a redundant
`ident_continue()` test on it.

src/libsyntax/parse/lexer/mod.rs

index c39eb1594b28bf3591b8546a89421655c795c0cc..02f76fa56e40221cbd8920d21a4dedd455a9929d 100644 (file)
@@ -516,6 +516,7 @@ fn scan_optional_raw_name(&mut self) -> Option<ast::Name> {
             return None;
         }
         let start = self.pos;
+        self.bump();
         while ident_continue(self.ch) {
             self.bump();
         }
@@ -1155,6 +1156,7 @@ fn next_token_inner(&mut self) -> Result<token::Token, ()> {
                 }
 
                 let start = self.pos;
+                self.bump();
                 while ident_continue(self.ch) {
                     self.bump();
                 }