1
0
mirror of https://github.com/vlang/v.git synced 2023-08-10 21:13:21 +03:00

parser: minor cleanup in comptime.v (#16338)

This commit is contained in:
yuyi 2022-11-06 13:23:28 +08:00 committed by GitHub
parent e3fed4c3eb
commit 25b8ae2189
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -129,7 +129,7 @@ fn (mut p Parser) comptime_call() ast.ComptimeCall {
mut embed_compression_type := 'none' mut embed_compression_type := 'none'
if is_embed_file { if is_embed_file {
if p.tok.kind == .comma { if p.tok.kind == .comma {
p.check(.comma) p.next()
p.check(.dot) p.check(.dot)
embed_compression_type = p.check_name() embed_compression_type = p.check_name()
} }
@ -351,7 +351,7 @@ fn (mut p Parser) comptime_selector(left ast.Expr) ast.Expr {
args := p.call_args() args := p.call_args()
p.check(.rpar) p.check(.rpar)
if p.tok.kind == .key_orelse { if p.tok.kind == .key_orelse {
p.check(.key_orelse) p.next()
p.check(.lcbr) p.check(.lcbr)
} }
return ast.ComptimeCall{ return ast.ComptimeCall{
@ -366,7 +366,7 @@ fn (mut p Parser) comptime_selector(left ast.Expr) ast.Expr {
} }
mut has_parens := false mut has_parens := false
if p.tok.kind == .lpar { if p.tok.kind == .lpar {
p.check(.lpar) p.next()
has_parens = true has_parens = true
} else { } else {
p.warn_with_pos('use brackets instead e.g. `s.$(field.name)` - run vfmt', p.tok.pos()) p.warn_with_pos('use brackets instead e.g. `s.$(field.name)` - run vfmt', p.tok.pos())