fix: 1.set default value in gen_jsons when type is option not none;2.change default json.decode behavior for reduce ambiguity '{}' will be default type value and 'null' will be none value for option value

This commit is contained in:
谢克 2025-09-06 11:15:35 +08:00
parent cf9bd20726
commit 70970e2d79

View file

@ -121,7 +121,6 @@ ${dec_fn_dec} {
')
if utyp.has_flag(.option) {
none_str := g.expr_string(ast.None{})
dec.writeln('\tif (cJSON_IsNull(root)) {')
dec.writeln('\t${result_name}_${ret_styp} ret;')
dec.writeln('\t_result_ok(&res, (${result_name}*)&ret, sizeof(res));')