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

parser: add a temporary exception for C.statvfs as well (same name reused for function *and* struct)

This commit is contained in:
Delyan Angelov 2023-01-30 21:11:59 +02:00
parent d1f57ead71
commit 5abca37ff7
No known key found for this signature in database
GPG Key ID: 66886C0F12D595ED

View File

@ -2516,7 +2516,8 @@ pub fn (mut p Parser) name_expr() ast.Expr {
// type cast. TODO: finish // type cast. TODO: finish
// if name in ast.builtin_type_names_to_idx { // if name in ast.builtin_type_names_to_idx {
if (!known_var && (name in p.table.type_idxs || name_w_mod in p.table.type_idxs) if (!known_var && (name in p.table.type_idxs || name_w_mod in p.table.type_idxs)
&& name !in ['C.stat', 'C.sigaction']) || is_mod_cast || is_generic_cast && name !in ['C.statvfs', 'C.stat', 'C.sigaction']) || is_mod_cast
|| is_generic_cast
|| (language == .v && name.len > 0 && name[0].is_capital()) { || (language == .v && name.len > 0 && name[0].is_capital()) {
// MainLetter(x) is *always* a cast, as long as it is not `C.` // MainLetter(x) is *always* a cast, as long as it is not `C.`
// TODO handle C.stat() // TODO handle C.stat()