parser: fix small performance regression after 1d83ab6b (by avoiding needless interpolation in hot paths)

pull/13766/head
Delyan Angelov 2022-03-18 12:52:03 +02:00
parent 236bcda549
commit 0ca87ad09f
No known key found for this signature in database
GPG Key ID: 66886C0F12D595ED
1 changed files with 2 additions and 2 deletions

View File

@ -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`')
}