mirror of
https://github.com/vlang/v.git
synced 2023-08-10 21:13:21 +03:00
Check for type, not name
This commit is contained in:
parent
c3f9b90911
commit
b6ecbd8bc3
@ -2656,17 +2656,17 @@ fn (p mut Parser) array_init() string {
|
|||||||
// Make sure there's no space in `[10]byte`
|
// Make sure there's no space in `[10]byte`
|
||||||
if !nextc.is_space() {
|
if !nextc.is_space() {
|
||||||
p.check(.rsbr)
|
p.check(.rsbr)
|
||||||
name := p.check_name()
|
array_elem_typ := p.get_type()
|
||||||
if p.table.known_type(name) {
|
if p.table.known_type(array_elem_typ) {
|
||||||
p.cgen.resetln('')
|
p.cgen.resetln('')
|
||||||
p.gen('{0}')
|
p.gen('{0}')
|
||||||
if is_const_len {
|
if is_const_len {
|
||||||
return '[${p.mod}__$lit]$name'
|
return '[${p.mod}__$lit]$array_elem_typ'
|
||||||
}
|
}
|
||||||
return '[$lit]$name'
|
return '[$lit]$array_elem_typ'
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
p.error('bad type `$name`')
|
p.error('bad type `$array_elem_typ`')
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user