mirror of
https://github.com/vlang/v.git
synced 2023-08-10 21:13:21 +03:00
compiler: emit Option_ typedef for fn args and struct fields
This commit is contained in:

committed by
Alexander Medvednikov

parent
5536eb581c
commit
26fb7e0821
@ -368,10 +368,15 @@ fn (p mut Parser) fn_decl() {
|
||||
p.check(.lcbr)
|
||||
//p.fgen_nl()
|
||||
}
|
||||
// Register ?option type
|
||||
if typ.starts_with('Option_') {
|
||||
// Register ?option type for return value and args
|
||||
if typ.starts_with('Option_') {
|
||||
p.cgen.typedefs << 'typedef Option $typ;'
|
||||
}
|
||||
for arg in f.args {
|
||||
if arg.typ.starts_with('Option_') {
|
||||
p.cgen.typedefs << 'typedef Option $arg.typ;'
|
||||
}
|
||||
}
|
||||
// Register function
|
||||
f.typ = typ
|
||||
str_args := f.str_args(p.table)
|
||||
|
Reference in New Issue
Block a user