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

parser: clean up array_init() (#17947)

This commit is contained in:
yuyi 2023-04-14 13:36:57 +08:00 committed by GitHub
parent 76fd55a693
commit c59a5bbf05
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -10,7 +10,6 @@ fn (mut p Parser) array_init(is_option bool) ast.ArrayInit {
first_pos := p.tok.pos()
mut last_pos := p.tok.pos()
p.check(.lsbr)
// p.warn('array_init() exp=$p.expected_type')
mut array_type := ast.void_type
mut elem_type := ast.void_type
mut elem_type_pos := first_pos
@ -61,12 +60,6 @@ fn (mut p Parser) array_init(is_option bool) ast.ArrayInit {
}
p.inside_array_lit = old_inside_array_lit
line_nr := p.tok.line_nr
$if tinyc {
// Note: do not remove the next line without testing
// v selfcompilation with tcc first
tcc_stack_bug := 12345
_ = tcc_stack_bug
}
last_pos = p.tok.pos()
p.check(.rsbr)
if exprs.len == 1 && p.tok.line_nr == line_nr
@ -104,7 +97,7 @@ fn (mut p Parser) array_init(is_option bool) ast.ArrayInit {
first_pos.extend(last_pos))
}
} else {
if p.tok.kind == .not { // && p.tok.line_nr == p.prev_tok.line_nr {
if p.tok.kind == .not {
last_pos = p.tok.pos()
is_fixed = true
has_val = true