mirror of
https://github.com/vlang/v.git
synced 2023-08-10 21:13:21 +03:00
scanner: small optimisation of the ident_name hot loop
This commit is contained in:
@@ -222,10 +222,11 @@ fn (mut s Scanner) ident_name() string {
|
|||||||
s.pos++
|
s.pos++
|
||||||
for s.pos < s.text.len {
|
for s.pos < s.text.len {
|
||||||
c := s.text[s.pos]
|
c := s.text[s.pos]
|
||||||
if !(util.is_name_char(c) || c.is_digit()) {
|
if (c >= `a` && c <= `z`) || (c >= `A` && c <= `Z`) || (c >= `0` && c <= `9`) || c == `_` {
|
||||||
break
|
s.pos++
|
||||||
|
continue
|
||||||
}
|
}
|
||||||
s.pos++
|
break
|
||||||
}
|
}
|
||||||
name := s.text[start..s.pos]
|
name := s.text[start..s.pos]
|
||||||
s.pos--
|
s.pos--
|
||||||
|
|||||||
Reference in New Issue
Block a user