[vala/0.50] codegen: Handle NoWrapper attribute of interface methods on caller side
- From: Rico Tzschichholz <ricotz src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [vala/0.50] codegen: Handle NoWrapper attribute of interface methods on caller side
- Date: Sun, 28 Feb 2021 08:58:21 +0000 (UTC)
commit 9fb18b884ff30cda56ed1bc1e5b85db7bb717c5e
Author: Rico Tzschichholz <ricotz ubuntu com>
Date: Sat Jan 30 11:44:17 2021 +0100
codegen: Handle NoWrapper attribute of interface methods on caller side
codegen/valaccodememberaccessmodule.vala | 9 ++++++++-
tests/Makefile.am | 1 +
tests/methods/nowrapper-interface.vala | 15 +++++++++++++++
3 files changed, 24 insertions(+), 1 deletion(-)
---
diff --git a/codegen/valaccodememberaccessmodule.vala b/codegen/valaccodememberaccessmodule.vala
index 3199ea24e..f2177027f 100644
--- a/codegen/valaccodememberaccessmodule.vala
+++ b/codegen/valaccodememberaccessmodule.vala
@@ -78,7 +78,14 @@ public abstract class Vala.CCodeMemberAccessModule : CCodeControlFlowModule {
set_cvalue (expr, new CCodeIdentifier (get_ccode_name
(m.base_method)));
}
} else if (m.base_interface_method != null) {
- set_cvalue (expr, new CCodeIdentifier (get_ccode_name
(m.base_interface_method)));
+ if (m.base_interface_method.get_attribute ("NoWrapper") != null) {
+ var base_iface = (Interface) m.base_interface_method.parent_symbol;
+ var vclass = new CCodeFunctionCall (new CCodeIdentifier
(get_ccode_interface_get_function (base_iface)));
+ vclass.add_argument (pub_inst);
+ set_cvalue (expr, new CCodeMemberAccess.pointer (vclass,
get_ccode_vfunc_name (m)));
+ } else {
+ set_cvalue (expr, new CCodeIdentifier (get_ccode_name
(m.base_interface_method)));
+ }
} else if (m is CreationMethod) {
set_cvalue (expr, new CCodeIdentifier (get_ccode_real_name (m)));
} else {
diff --git a/tests/Makefile.am b/tests/Makefile.am
index 35c3fd7ff..7fa5cdddc 100644
--- a/tests/Makefile.am
+++ b/tests/Makefile.am
@@ -218,6 +218,7 @@ TESTS = \
methods/argument-named.vala \
methods/delegate-target.vala \
methods/generics.vala \
+ methods/nowrapper-interface.vala \
methods/nowrapper-no-vfunc.test \
methods/params-array.vala \
methods/params-array-abstract.test \
diff --git a/tests/methods/nowrapper-interface.vala b/tests/methods/nowrapper-interface.vala
new file mode 100644
index 000000000..ba69d8789
--- /dev/null
+++ b/tests/methods/nowrapper-interface.vala
@@ -0,0 +1,15 @@
+interface IFoo : Object {
+ [NoWrapper]
+ public abstract int bar ();
+}
+
+class Foo : Object, IFoo {
+ int bar () {
+ return 42;
+ }
+}
+
+void main () {
+ var foo = new Foo ();
+ assert (foo.bar () == 42);
+}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]