diff options
author | Rico Tzschichholz <ricotz@ubuntu.com> | 2023-04-13 08:25:02 +0200 |
---|---|---|
committer | Rico Tzschichholz <ricotz@ubuntu.com> | 2023-04-13 08:48:53 +0200 |
commit | 0b2e7537e5575f1daabb37e93b5f74c78fd29eff (patch) | |
tree | 9b069b851fe5aef11865538d77cb9009ce6659c9 /codegen | |
parent | 5abae64280233454d784c46e0d32804d05ad2aeb (diff) | |
download | vala-0b2e7537e5575f1daabb37e93b5f74c78fd29eff.tar.gz |
codegen: Return CCodeInvalidExpression instead of null
This fixes the following criticals:
vala_ccode_cast_expression_construct: assertion 'expr != NULL' failed
vala_ccode_function_call_add_argument: assertion 'expr != NULL' failed
Remove dead code, this is already handled in get_dup_func_expression()
Diffstat (limited to 'codegen')
-rw-r--r-- | codegen/valaccodebasemodule.vala | 7 |
1 files changed, 2 insertions, 5 deletions
diff --git a/codegen/valaccodebasemodule.vala b/codegen/valaccodebasemodule.vala index 51d402712..d1e665747 100644 --- a/codegen/valaccodebasemodule.vala +++ b/codegen/valaccodebasemodule.vala @@ -3519,7 +3519,7 @@ public abstract class Vala.CCodeBaseModule : CodeGenerator { unref_function = get_ccode_unref_function ((ObjectTypeSymbol) type.type_symbol); if (type.type_symbol is Interface && unref_function == null) { Report.error (type.source_reference, "missing class prerequisite for interface `%s', add GLib.Object to interface declaration if unsure", type.type_symbol.get_full_name ()); - return null; + return new CCodeInvalidExpression (); } } else { if (get_ccode_is_gboxed (type.type_symbol)) { @@ -6296,10 +6296,7 @@ public abstract class Vala.CCodeBaseModule : CodeGenerator { if (!gvalue_boxing && !gvariant_boxing && target_type.value_owned && (!type.value_owned || boxing || unboxing || array_needs_copy) && requires_copy (target_type) && !(type is NullType)) { // need to copy value var copy = (GLibValue) copy_value (result, node); - if (target_type.type_symbol is Interface && copy == null) { - Report.error (node.source_reference, "missing class prerequisite for interface `%s', add GLib.Object to interface declaration if unsure", target_type.type_symbol.get_full_name ()); - return result; - } + // need to free old array after copying it if (array_needs_copy && requires_destroy (type)) { result.value_type = type.copy (); |