[vala/staging: 6/10] codegen: Add type declaration for errors and error domains as needed
- From: Rico Tzschichholz <ricotz src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [vala/staging: 6/10] codegen: Add type declaration for errors and error domains as needed
- Date: Wed, 21 Nov 2018 19:24:21 +0000 (UTC)
commit 6f5a64b7f21e18d732f88d9b20fc326e3089f8db
Author: Rico Tzschichholz <ricotz ubuntu com>
Date: Wed Nov 21 15:33:24 2018 +0100
codegen: Add type declaration for errors and error domains as needed
codegen/valaccodebasemodule.vala | 4 ++++
codegen/valagerrormodule.vala | 2 ++
2 files changed, 6 insertions(+)
---
diff --git a/codegen/valaccodebasemodule.vala b/codegen/valaccodebasemodule.vala
index aabcd9b93..a1fe8b3a0 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");
@@ -1513,6 +1515,8 @@ public abstract class Vala.CCodeBaseModule : CodeGenerator {
var error_type = (ErrorType) type;
if (error_type.error_domain != null) {
generate_error_domain_declaration (error_type.error_domain, decl_space);
+ } else {
+ generate_class_declaration (gerror, decl_space);
}
} else if (type is PointerType) {
var pointer_type = (PointerType) type;
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]