[vala/0.36] codegen: Replace some unfortunate asserts with internal error reports
- From: Rico Tzschichholz <ricotz src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [vala/0.36] codegen: Replace some unfortunate asserts with internal error reports
- Date: Thu, 28 Feb 2019 17:40:34 +0000 (UTC)
commit fece4414d6cfbc14c9a486ae9fb3fed3bbd5e866
Author: Rico Tzschichholz <ricotz ubuntu com>
Date: Wed Jan 23 21:36:12 2019 +0100
codegen: Replace some unfortunate asserts with internal error reports
codegen/valaccodebasemodule.vala | 6 ++++--
codegen/valaccodemethodmodule.vala | 3 ++-
codegen/valagtypemodule.vala | 2 +-
3 files changed, 7 insertions(+), 4 deletions(-)
---
diff --git a/codegen/valaccodebasemodule.vala b/codegen/valaccodebasemodule.vala
index 3c6635452..504b01ee0 100644
--- a/codegen/valaccodebasemodule.vala
+++ b/codegen/valaccodebasemodule.vala
@@ -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)));
diff --git a/codegen/valaccodemethodmodule.vala b/codegen/valaccodemethodmodule.vala
index 405bac13c..15c726f60 100644
--- a/codegen/valaccodemethodmodule.vala
+++ b/codegen/valaccodemethodmodule.vala
@@ -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);
diff --git a/codegen/valagtypemodule.vala b/codegen/valagtypemodule.vala
index 92c384063..995f81c21 100644
--- a/codegen/valagtypemodule.vala
+++ b/codegen/valagtypemodule.vala
@@ -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");
}
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]