[vala/staging: 2/2] Revert "girwriter: Use appropriate get_ccode_* functions"
- From: Rico Tzschichholz <ricotz src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [vala/staging: 2/2] Revert "girwriter: Use appropriate get_ccode_* functions"
- Date: Mon, 10 Aug 2020 11:47:49 +0000 (UTC)
commit 11ac7af23a9f8f67b2b00afe26600a469f2c6fed
Author: Rico Tzschichholz <ricotz ubuntu com>
Date: Mon Aug 10 13:43:49 2020 +0200
Revert "girwriter: Use appropriate get_ccode_* functions"
This reverts commit 7b0498d4f4fcaa3bd9e04d65560324847136f0ac.
Fixes https://gitlab.gnome.org/GNOME/vala/issues/1059
codegen/valagirwriter.vala | 55 +++++++++++++++++++++-----------
tests/girwriter/GirTest-1.0.gir-expected | 2 +-
2 files changed, 37 insertions(+), 20 deletions(-)
---
diff --git a/codegen/valagirwriter.vala b/codegen/valagirwriter.vala
index ad476f55e..ff4600cb7 100644
--- a/codegen/valagirwriter.vala
+++ b/codegen/valagirwriter.vala
@@ -519,32 +519,38 @@ public class Vala.GIRWriter : CodeVisitor {
foreach (Method m in cl.get_methods ()) {
if (m.is_abstract || m.is_virtual) {
if (m.coroutine) {
+ string finish_name = m.name;
+ if (finish_name.has_suffix ("_async")) {
+ finish_name = finish_name.substring (0,
finish_name.length - "_async".length);
+ }
+ finish_name += "_finish";
+
write_indent ();
- buffer.append_printf("<field name=\"%s\"",
get_ccode_vfunc_name (m));
+ buffer.append_printf("<field name=\"%s\"", m.name);
write_symbol_attributes (m);
buffer.append_printf (">\n");
indent++;
- do_write_signature (m, "callback", true, get_ccode_vfunc_name
(m), get_ccode_name (m), m.get_async_begin_parameters (), new VoidType (), false, false, false);
+ do_write_signature (m, "callback", true, m.name,
get_ccode_name (m), m.get_async_begin_parameters (), new VoidType (), false, false, false);
indent--;
write_indent ();
buffer.append_printf ("</field>\n");
write_indent ();
- buffer.append_printf("<field name=\"%s\"",
get_ccode_finish_vfunc_name (m));
+ buffer.append_printf("<field name=\"%s\"", finish_name);
write_symbol_attributes (m);
buffer.append_printf (">\n");
indent++;
- do_write_signature (m, "callback", true,
get_ccode_finish_vfunc_name (m), get_ccode_finish_name (m), m.get_async_end_parameters (), m.return_type,
m.tree_can_fail, false, false);
+ do_write_signature (m, "callback", true, finish_name,
get_ccode_finish_name (m), m.get_async_end_parameters (), m.return_type, m.tree_can_fail, false, false);
indent--;
write_indent ();
buffer.append_printf ("</field>\n");
} else {
write_indent ();
- buffer.append_printf("<field name=\"%s\"",
get_ccode_vfunc_name (m));
+ buffer.append_printf("<field name=\"%s\"", m.name);
write_symbol_attributes (m);
buffer.append_printf (">\n");
indent++;
- do_write_signature (m, "callback", true, get_ccode_vfunc_name
(m), get_ccode_name (m), m.get_parameters (), m.return_type, m.tree_can_fail, false, false);
+ do_write_signature (m, "callback", true, m.name,
get_ccode_name (m), m.get_parameters (), m.return_type, m.tree_can_fail, false, false);
indent--;
write_indent ();
buffer.append_printf ("</field>\n");
@@ -700,32 +706,38 @@ public class Vala.GIRWriter : CodeVisitor {
foreach (Method m in iface.get_methods ()) {
if (m.is_abstract || m.is_virtual) {
if (m.coroutine) {
+ string finish_name = m.name;
+ if (finish_name.has_suffix ("_async")) {
+ finish_name = finish_name.substring (0, finish_name.length -
"_async".length);
+ }
+ finish_name += "_finish";
+
write_indent ();
- buffer.append_printf("<field name=\"%s\"", get_ccode_vfunc_name (m));
+ buffer.append_printf("<field name=\"%s\"", m.name);
write_symbol_attributes (m);
buffer.append_printf (">\n");
indent++;
- do_write_signature (m, "callback", true, get_ccode_vfunc_name (m),
get_ccode_name (m), m.get_async_begin_parameters (), new VoidType (), false, false, false);
+ do_write_signature (m, "callback", true, m.name, get_ccode_name (m),
m.get_async_begin_parameters (), new VoidType (), false, false, false);
indent--;
write_indent ();
buffer.append_printf ("</field>\n");
write_indent ();
- buffer.append_printf("<field name=\"%s\"",
get_ccode_finish_vfunc_name (m));
+ buffer.append_printf("<field name=\"%s\"", finish_name);
write_symbol_attributes (m);
buffer.append_printf (">\n");
indent++;
- do_write_signature (m, "callback", true, get_ccode_finish_vfunc_name
(m), get_ccode_finish_name (m), m.get_async_end_parameters (), m.return_type, m.tree_can_fail, false, false);
+ do_write_signature (m, "callback", true, finish_name,
get_ccode_finish_name (m), m.get_async_end_parameters (), m.return_type, m.tree_can_fail, false, false);
indent--;
write_indent ();
buffer.append_printf ("</field>\n");
} else {
write_indent ();
- buffer.append_printf("<field name=\"%s\"", get_ccode_vfunc_name (m));
+ buffer.append_printf("<field name=\"%s\"", m.name);
write_symbol_attributes (m);
buffer.append_printf (">\n");
indent++;
- do_write_signature (m, "callback", true, get_ccode_vfunc_name (m),
get_ccode_name (m), m.get_parameters (), m.return_type, m.tree_can_fail, false, false);
+ do_write_signature (m, "callback", true, m.name, get_ccode_name (m),
m.get_parameters (), m.return_type, m.tree_can_fail, false, false);
indent--;
write_indent ();
buffer.append_printf ("</field>\n");
@@ -738,11 +750,11 @@ public class Vala.GIRWriter : CodeVisitor {
if (prop.get_accessor != null) {
var m = prop.get_accessor.get_method ();
write_indent ();
- buffer.append_printf("<field name=\"%s\"", get_ccode_vfunc_name (m));
+ buffer.append_printf("<field name=\"%s\"", m.name);
write_symbol_attributes (m);
buffer.append_printf (">\n");
indent++;
- do_write_signature (m, "callback", true, get_ccode_vfunc_name (m),
get_ccode_name (m), m.get_parameters (), m.return_type, m.tree_can_fail, false, false);
+ do_write_signature (m, "callback", true, m.name, get_ccode_name (m),
m.get_parameters (), m.return_type, m.tree_can_fail, false, false);
indent--;
write_indent ();
buffer.append_printf ("</field>\n");
@@ -751,11 +763,11 @@ public class Vala.GIRWriter : CodeVisitor {
if (prop.set_accessor != null && prop.set_accessor.writable) {
var m = prop.set_accessor.get_method ();
write_indent ();
- buffer.append_printf("<field name=\"%s\"", get_ccode_vfunc_name (m));
+ buffer.append_printf("<field name=\"%s\"", m.name);
write_symbol_attributes (m);
buffer.append_printf (">\n");
indent++;
- do_write_signature (m, "callback", true, get_ccode_vfunc_name (m),
get_ccode_name (m), m.get_parameters (), m.return_type, m.tree_can_fail, false, false);
+ do_write_signature (m, "callback", true, m.name, get_ccode_name (m),
m.get_parameters (), m.return_type, m.tree_can_fail, false, false);
indent--;
write_indent ();
buffer.append_printf ("</field>\n");
@@ -1303,10 +1315,15 @@ public class Vala.GIRWriter : CodeVisitor {
}
if (m.coroutine) {
- do_write_signature (m, tag_name, instance, get_ccode_vfunc_name (m), get_ccode_name
(m), m.get_async_begin_parameters (), new VoidType (), false, true, write_attributes);
- do_write_signature (m, tag_name, instance, get_ccode_finish_vfunc_name (m),
get_ccode_finish_name (m), m.get_async_end_parameters (), m.return_type, m.tree_can_fail, false,
write_attributes);
+ string finish_name = name;
+ if (finish_name.has_suffix ("_async")) {
+ finish_name = finish_name.substring (0, finish_name.length - "_async".length);
+ }
+ finish_name += "_finish";
+ do_write_signature (m, tag_name, instance, name, get_ccode_name (m),
m.get_async_begin_parameters (), new VoidType (), false, true, write_attributes);
+ do_write_signature (m, tag_name, instance, finish_name, get_ccode_finish_name (m),
m.get_async_end_parameters (), m.return_type, m.tree_can_fail, false, write_attributes);
} else {
- do_write_signature (m, tag_name, instance, get_ccode_vfunc_name (m), get_ccode_name
(m), m.get_parameters (), m.return_type, m.tree_can_fail, true, write_attributes);
+ do_write_signature (m, tag_name, instance, name, get_ccode_name (m), m.get_parameters
(), m.return_type, m.tree_can_fail, true, write_attributes);
}
}
diff --git a/tests/girwriter/GirTest-1.0.gir-expected b/tests/girwriter/GirTest-1.0.gir-expected
index 9298b634b..d7521ddcc 100644
--- a/tests/girwriter/GirTest-1.0.gir-expected
+++ b/tests/girwriter/GirTest-1.0.gir-expected
@@ -896,7 +896,7 @@
</callback>
</field>
<field name="signal_with_default_handlder">
- <callback name="signal_with_default_handlder" c:type="signal_with_default_handlder">
+ <callback name="object_test_signal_with_default_handlder"
c:type="object_test_signal_with_default_handlder">
<return-value transfer-ownership="full">
<type name="none" c:type="void"/>
</return-value>
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]