[vala/staging: 6/9] codegen: Add type declaration for method errors and error domains as needed
- From: Rico Tzschichholz <ricotz src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [vala/staging: 6/9] codegen: Add type declaration for method errors and error domains as needed
- Date: Wed, 21 Nov 2018 16:17:40 +0000 (UTC)
commit 5ba5d8edb22565195ab6f78b79a7bad30cfa6f0d
Author: Rico Tzschichholz <ricotz ubuntu com>
Date: Wed Nov 21 15:33:24 2018 +0100
codegen: Add type declaration for method errors and error domains as needed
codegen/valaccodebasemodule.vala | 5 +++++
codegen/valagerrormodule.vala | 2 ++
2 files changed, 7 insertions(+)
---
diff --git a/codegen/valaccodebasemodule.vala b/codegen/valaccodebasemodule.vala
index aabcd9b93..e197b1c60 100644
--- a/codegen/valaccodebasemodule.vala
+++ b/codegen/valaccodebasemodule.vala
@@ -325,6 +325,7 @@ public abstract class Vala.CCodeBaseModule : CodeGenerator {
public DataType delegate_target_type;
public DelegateType delegate_target_destroy_type;
Delegate destroy_notify;
+ Class gerror;
public bool in_plugin = false;
public string module_init_param_name;
@@ -475,6 +476,7 @@ public abstract class Vala.CCodeBaseModule : CodeGenerator {
gthreadpool_type = (TypeSymbol) glib_ns.scope.lookup ("ThreadPool");
gdestroynotify_type = new DelegateType ((Delegate) glib_ns.scope.lookup
("DestroyNotify"));
+ gerror = (Class) root_symbol.scope.lookup ("GLib").scope.lookup ("Error");
gquark_type = new IntegerType ((Struct) glib_ns.scope.lookup ("Quark"));
gvalue_type = (Struct) glib_ns.scope.lookup ("Value");
gvariant_type = (Class) glib_ns.scope.lookup ("Variant");
@@ -1522,6 +1524,9 @@ public abstract class Vala.CCodeBaseModule : CodeGenerator {
if (method.has_type_parameters () && !get_ccode_simple_generics (method)) {
generate_struct_declaration ((Struct) gtype_type, decl_space);
}
+ if (method.has_error_type_parameter ()) {
+ generate_class_declaration (gerror, decl_space);
+ }
}
foreach (DataType type_arg in type.get_type_arguments ()) {
diff --git a/codegen/valagerrormodule.vala b/codegen/valagerrormodule.vala
index a0cefb9d1..d29d09ca1 100644
--- a/codegen/valagerrormodule.vala
+++ b/codegen/valagerrormodule.vala
@@ -33,6 +33,8 @@ public class Vala.GErrorModule : CCodeDelegateModule {
return;
}
+ generate_type_declaration (gquark_type, decl_space);
+
var cenum = new CCodeEnum (get_ccode_name (edomain));
foreach (ErrorCode ecode in edomain.get_codes ()) {
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]