mirror of
https://github.com/vlang/v.git
synced 2023-08-10 21:13:21 +03:00
checker: avoid get_type_symbol panic inside array_init (#9800)
This commit is contained in:
parent
9ec91f4d58
commit
dde3189e66
@ -3298,12 +3298,16 @@ pub fn (mut c Checker) array_init(mut array_init ast.ArrayInit) ast.Type {
|
|||||||
if array_init.has_len {
|
if array_init.has_len {
|
||||||
c.ensure_sumtype_array_has_default_value(array_init)
|
c.ensure_sumtype_array_has_default_value(array_init)
|
||||||
}
|
}
|
||||||
c.ensure_type_exists(array_init.elem_type, array_init.elem_type_pos) or {}
|
if array_init.elem_type != 0 {
|
||||||
|
c.ensure_type_exists(array_init.elem_type, array_init.elem_type_pos) or {}
|
||||||
|
}
|
||||||
return array_init.typ
|
return array_init.typ
|
||||||
}
|
}
|
||||||
if array_init.is_fixed {
|
if array_init.is_fixed {
|
||||||
c.ensure_sumtype_array_has_default_value(array_init)
|
c.ensure_sumtype_array_has_default_value(array_init)
|
||||||
c.ensure_type_exists(array_init.elem_type, array_init.elem_type_pos) or {}
|
if array_init.elem_type != 0 {
|
||||||
|
c.ensure_type_exists(array_init.elem_type, array_init.elem_type_pos) or {}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
// a = []
|
// a = []
|
||||||
if array_init.exprs.len == 0 {
|
if array_init.exprs.len == 0 {
|
||||||
|
Loading…
Reference in New Issue
Block a user