]> 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>
Thu, 28 Feb 2019 17:25:40 +0000 (18:25 +0100)
codegen/valaccodebasemodule.vala
codegen/valaccodemethodmodule.vala
codegen/valagtypemodule.vala

index 3c663545252600646a8e296e6b87ffd2ca81fa14..504b01ee0106091ce6ad7552a045a214d9b28f16 100644 (file)
@@ -5546,14 +5546,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 405bac13cd48afdf3002154a33fa365c58f6057c..15c726f603af991630ceadf94f1140ece4a668c7 100644 (file)
@@ -970,7 +970,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 92c3840630491f9d961d0b59b0dc3508a4bca1c2..995f81c21142b6fc476d79bc6bac135d0187681f 100644 (file)
@@ -2039,7 +2039,7 @@ public class Vala.GTypeModule : GErrorModule {
                                        type_struct.add_declaration (vdecl);
                                }
                        } else {
-                               assert_not_reached ();
+                               Report.error (sym.source_reference, "internal: Unsupported symbol");
                        }
                }