]> git.ipfire.org Git - thirdparty/vala.git/commitdiff
codegen: Replace some unfortunate asserts with internal error reports
authorRico Tzschichholz <ricotz@ubuntu.com>
Wed, 23 Jan 2019 20:36:12 +0000 (21:36 +0100)
committerRico Tzschichholz <ricotz@ubuntu.com>
Tue, 26 Feb 2019 15:13:37 +0000 (16:13 +0100)
codegen/valaccodebasemodule.vala
codegen/valaccodemethodmodule.vala
codegen/valagtypemodule.vala

index 32ca7f349f4071cb4ed57de4700958c3ab444f81..519fd8589c1d9e916a4f6fdf51a80092a363bb06 100644 (file)
@@ -5618,14 +5618,16 @@ public abstract class Vala.CCodeBaseModule : CodeGenerator {
                                        } else if (cleft is CCodeConstant) {
                                                left = ((CCodeConstant) cleft).name;
                                        } else {
-                                               assert_not_reached ();
+                                               Report.error (expr.source_reference, "internal: Unsupported expression");
+                                               left = "NULL";
                                        }
                                        if (cright is CCodeIdentifier) {
                                                right = ((CCodeIdentifier) cright).name;
                                        } else if (cright is CCodeConstant) {
                                                right = ((CCodeConstant) cright).name;
                                        } else {
-                                               assert_not_reached ();
+                                               Report.error (expr.source_reference, "internal: Unsupported expression");
+                                               right = "NULL";
                                        }
 
                                        set_cvalue (expr, new CCodeConstant ("%s %s".printf (left, right)));
index 23113c3c779b90c3f2685a6c562f7438e28def68..0c8dbe25abaaea332c235ebecd1ec9f790e1ea91 100644 (file)
@@ -951,7 +951,8 @@ public abstract class Vala.CCodeMethodModule : CCodeStructModule {
                        } else if (parent_type is Enum) {
                                this_type = new EnumValueType ((Enum) parent_type);
                        } else {
-                               assert_not_reached ();
+                               Report.error (parent_type.source_reference, "internal: Unsupported symbol type");
+                               this_type = new InvalidType ();
                        }
 
                        generate_type_declaration (this_type, decl_space);
index 603590aff2fae8b76e1674e45054f6c066c77a29..a654c0197de820d6381b29793112c994a0b9e715 100644 (file)
@@ -257,7 +257,7 @@ public class Vala.GTypeModule : GErrorModule {
                                        var f = (Field) s;
                                        generate_struct_field_declaration (cl, f, instance_struct, type_struct, decl_space, ref has_struct_member);
                                } else {
-                                       assert_not_reached ();
+                                       Report.error (s.source_reference, "internal: Unsupported symbol");
                                }
                        }
                } else {
@@ -2180,7 +2180,7 @@ public class Vala.GTypeModule : GErrorModule {
                                        type_struct.add_declaration (vdecl);
                                }
                        } else {
-                               assert_not_reached ();
+                               Report.error (sym.source_reference, "internal: Unsupported symbol");
                        }
                }