[vala/staging: 1/3] codegen: Include header for base-symbols when connecting vfuncs
- From: Rico Tzschichholz <ricotz src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [vala/staging: 1/3] codegen: Include header for base-symbols when connecting vfuncs
- Date: Wed, 5 Aug 2020 06:23:23 +0000 (UTC)
commit b249e97a50f94afde3fa0ae0df6af9681c5eab79
Author: Rico Tzschichholz <ricotz ubuntu com>
Date: Wed Aug 5 07:27:53 2020 +0200
codegen: Include header for base-symbols when connecting vfuncs
This eases the handling of types which are split over different headers.
codegen/valagtypemodule.vala | 20 ++++++++++++++++++++
1 file changed, 20 insertions(+)
---
diff --git a/codegen/valagtypemodule.vala b/codegen/valagtypemodule.vala
index 9d01150ab..8b2c6c03d 100644
--- a/codegen/valagtypemodule.vala
+++ b/codegen/valagtypemodule.vala
@@ -1264,6 +1264,8 @@ public class Vala.GTypeModule : GErrorModule {
// there is currently no default handler for abstract async methods
if (!m.is_abstract || !m.coroutine) {
+ generate_method_declaration (m.base_method, cfile);
+
CCodeExpression cfunc = new CCodeIdentifier (get_ccode_real_name (m));
cfunc = cast_method_pointer (m.base_method, cfunc, base_type, (m.coroutine ?
1 : 3));
var ccast = new CCodeCastExpression (new CCodeIdentifier ("klass"), "%sClass
*".printf (get_ccode_name (base_type)));
@@ -1282,6 +1284,8 @@ public class Vala.GTypeModule : GErrorModule {
if (sig.default_handler == null) {
continue;
}
+ generate_method_declaration (sig.default_handler, cfile);
+
var ccast = new CCodeCastExpression (new CCodeIdentifier ("klass"), "%sClass
*".printf (get_ccode_name (cl)));
ccode.add_assignment (new CCodeMemberAccess.pointer (ccast, get_ccode_vfunc_name
(sig.default_handler)), new CCodeIdentifier (get_ccode_real_name (sig.default_handler)));
}
@@ -1298,10 +1302,14 @@ public class Vala.GTypeModule : GErrorModule {
if (!get_ccode_no_accessor_method (prop.base_property) &&
!get_ccode_concrete_accessor (prop.base_property)) {
if (prop.get_accessor != null) {
+ generate_property_accessor_declaration
(prop.base_property.get_accessor, cfile);
+
string cname = get_ccode_real_name (prop.get_accessor);
ccode.add_assignment (new CCodeMemberAccess.pointer (ccast,
"get_%s".printf (prop.name)), new CCodeIdentifier (cname));
}
if (prop.set_accessor != null) {
+ generate_property_accessor_declaration
(prop.base_property.set_accessor, cfile);
+
string cname = get_ccode_real_name (prop.set_accessor);
ccode.add_assignment (new CCodeMemberAccess.pointer (ccast,
"set_%s".printf (prop.name)), new CCodeIdentifier (cname));
}
@@ -1380,6 +1388,8 @@ public class Vala.GTypeModule : GErrorModule {
continue;
}
+ generate_method_declaration (m.base_interface_method, cfile);
+
var ciface = new CCodeIdentifier ("iface");
CCodeExpression cfunc;
if (m.is_abstract || m.is_virtual) {
@@ -1453,6 +1463,8 @@ public class Vala.GTypeModule : GErrorModule {
if (!get_ccode_no_accessor_method (prop.base_interface_property) &&
!get_ccode_concrete_accessor (prop.base_interface_property)) {
if (prop.get_accessor != null) {
+ generate_property_accessor_declaration
(prop.base_interface_property.get_accessor, cfile);
+
string cname = get_ccode_real_name (prop.get_accessor);
if (prop.is_abstract || prop.is_virtual) {
cname = get_ccode_name (prop.get_accessor);
@@ -1465,6 +1477,8 @@ public class Vala.GTypeModule : GErrorModule {
ccode.add_assignment (new CCodeMemberAccess.pointer (ciface,
"get_%s".printf (prop.name)), cfunc);
}
if (prop.set_accessor != null) {
+ generate_property_accessor_declaration
(prop.base_interface_property.set_accessor, cfile);
+
string cname = get_ccode_real_name (prop.set_accessor);
if (prop.is_abstract || prop.is_virtual) {
cname = get_ccode_name (prop.set_accessor);
@@ -1615,6 +1629,8 @@ public class Vala.GTypeModule : GErrorModule {
// there is currently no default handler for abstract async methods
if (!m.is_abstract || !m.coroutine) {
+ generate_method_declaration (m.base_method, cfile);
+
CCodeExpression cfunc = new CCodeIdentifier (get_ccode_real_name (m));
cfunc = cast_method_pointer (m.base_method, cfunc, base_type,
(m.coroutine ? 1 : 3));
var ccast = new CCodeCastExpression (new CCodeIdentifier ("self"),
"%s *".printf (get_ccode_name (base_type)));
@@ -1639,10 +1655,14 @@ public class Vala.GTypeModule : GErrorModule {
if (!get_ccode_no_accessor_method (prop.base_property) &&
!get_ccode_concrete_accessor (prop.base_property)) {
if (prop.get_accessor != null) {
+ generate_property_accessor_declaration
(prop.base_property.get_accessor, cfile);
+
string cname = get_ccode_real_name (prop.get_accessor);
ccode.add_assignment (new CCodeMemberAccess.pointer (ccast,
"get_%s".printf (prop.name)), new CCodeIdentifier (cname));
}
if (prop.set_accessor != null) {
+ generate_property_accessor_declaration
(prop.base_property.set_accessor, cfile);
+
string cname = get_ccode_real_name (prop.set_accessor);
ccode.add_assignment (new CCodeMemberAccess.pointer (ccast,
"set_%s".printf (prop.name)), new CCodeIdentifier (cname));
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]