ci: fix vls compilation
parent
62c3ad4953
commit
9057e9f1dd
|
@ -47,14 +47,29 @@ fn (mut g Gen) gen_jsons() {
|
|||
dec_fn_name := js_dec_name(styp)
|
||||
dec_fn_dec := 'Option_$styp ${dec_fn_name}(cJSON* root)'
|
||||
|
||||
init_styp := g.expr_string(ast.Expr(ast.StructInit{
|
||||
typ: utyp
|
||||
typ_str: styp
|
||||
}))
|
||||
mut init_styp := '$styp res'
|
||||
if sym.kind == .struct_ {
|
||||
mut skips := 0
|
||||
info := sym.info as ast.Struct
|
||||
for field in info.fields {
|
||||
for attr in field.attrs {
|
||||
if attr.name == 'skip' {
|
||||
skips++
|
||||
}
|
||||
}
|
||||
}
|
||||
if skips > 0 {
|
||||
init_styp += ' = '
|
||||
init_styp += g.expr_string(ast.Expr(ast.StructInit{
|
||||
typ: utyp
|
||||
typ_str: styp
|
||||
}))
|
||||
}
|
||||
}
|
||||
|
||||
dec.writeln('
|
||||
$dec_fn_dec {
|
||||
$styp res = $init_styp;
|
||||
$init_styp;
|
||||
if (!root) {
|
||||
const char *error_ptr = cJSON_GetErrorPtr();
|
||||
if (error_ptr != NULL) {
|
||||
|
|
Loading…
Reference in New Issue