mirror of
https://github.com/vlang/v.git
synced 2023-08-10 21:13:21 +03:00
parser: fix small performance regression after 1d83ab6b
(by avoiding needless interpolation in hot paths)
This commit is contained in:
parent
236bcda549
commit
0ca87ad09f
@ -1943,7 +1943,7 @@ pub fn (mut p Parser) parse_ident(language ast.Language) ast.Ident {
|
||||
p.register_auto_import('sync')
|
||||
}
|
||||
mut_pos := p.tok.pos()
|
||||
kind_name := '$p.tok.kind'
|
||||
modifier_kind := p.tok.kind
|
||||
is_mut := p.tok.kind == .key_mut || is_shared || is_atomic
|
||||
if is_mut {
|
||||
p.next()
|
||||
@ -1958,7 +1958,7 @@ pub fn (mut p Parser) parse_ident(language ast.Language) ast.Ident {
|
||||
}
|
||||
if p.tok.kind != .name {
|
||||
if is_mut || is_static || is_volatile {
|
||||
p.error_with_pos('the `$kind_name` keyword is invalid here', mut_pos)
|
||||
p.error_with_pos('the `$modifier_kind` keyword is invalid here', mut_pos)
|
||||
} else {
|
||||
p.error('unexpected token `$p.tok.lit`')
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user