mirror of
https://github.com/vlang/v.git
synced 2023-08-10 21:13:21 +03:00
improve the C struct check
This commit is contained in:
parent
6ae51b2cbf
commit
8b0de95c0a
@ -187,9 +187,10 @@ fn (p mut Parser) name_expr() string {
|
|||||||
p.check(.dot)
|
p.check(.dot)
|
||||||
name = p.lit
|
name = p.lit
|
||||||
// C struct initialization
|
// C struct initialization
|
||||||
if p.peek() == .lcbr {
|
if p.peek() == .lcbr && p.expected_type == '' { // not an expression
|
||||||
if !p.table.known_type(name) {
|
if !p.table.known_type(name) {
|
||||||
p.error('unknown C type `$name`')
|
p.error('unknown C type `$name`, ' +
|
||||||
|
'define it with `struct C.$name { ... }`')
|
||||||
}
|
}
|
||||||
return p.get_struct_type(name, true, ptr)
|
return p.get_struct_type(name, true, ptr)
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user