[vala/0.50] codegen: Add get_ccode_no_wrapper() and use it
- From: Rico Tzschichholz <ricotz src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [vala/0.50] codegen: Add get_ccode_no_wrapper() and use it
- Date: Sun, 28 Feb 2021 08:58:21 +0000 (UTC)
commit 61016ba1e233b42184ecb3f761fc5701670f3d1f
Author: Rico Tzschichholz <ricotz ubuntu com>
Date: Mon Feb 1 08:18:38 2021 +0100
codegen: Add get_ccode_no_wrapper() and use it
codegen/valaccode.vala | 4 ++++
codegen/valaccodememberaccessmodule.vala | 4 ++--
codegen/valaccodemethodcallmodule.vala | 2 +-
codegen/valaccodemethodmodule.vala | 4 ++--
codegen/valagasyncmodule.vala | 4 ++--
codegen/valagirwriter.vala | 4 ++--
6 files changed, 13 insertions(+), 9 deletions(-)
---
diff --git a/codegen/valaccode.vala b/codegen/valaccode.vala
index 175cd99ea..7671b2c50 100644
--- a/codegen/valaccode.vala
+++ b/codegen/valaccode.vala
@@ -466,6 +466,10 @@ namespace Vala {
return m.get_attribute_double ("CCode", "generic_type_pos");
}
+ public static bool get_ccode_no_wrapper (Method m) {
+ return m.get_attribute ("NoWrapper") != null;
+ }
+
public static string get_ccode_sentinel (Method m) {
return get_ccode_attribute(m).sentinel;
}
diff --git a/codegen/valaccodememberaccessmodule.vala b/codegen/valaccodememberaccessmodule.vala
index a3d8ef0f8..7b22c9f23 100644
--- a/codegen/valaccodememberaccessmodule.vala
+++ b/codegen/valaccodememberaccessmodule.vala
@@ -65,7 +65,7 @@ public abstract class Vala.CCodeMemberAccessModule : CCodeControlFlowModule {
}
if (m.base_method != null) {
- if (!method_has_wrapper (m.base_method)) {
+ if (get_ccode_no_wrapper (m.base_method)) {
var base_class = (Class) m.base_method.parent_symbol;
if (!base_class.is_compact) {
CCodeFunctionCall vclass;
@@ -86,7 +86,7 @@ public abstract class Vala.CCodeMemberAccessModule : CCodeControlFlowModule {
set_cvalue (expr, new CCodeIdentifier (get_ccode_name
(m.base_method)));
}
} else if (m.base_interface_method != null) {
- if (m.base_interface_method.get_attribute ("NoWrapper") != null) {
+ if (get_ccode_no_wrapper (m.base_interface_method)) {
var base_iface = (Interface) m.base_interface_method.parent_symbol;
CCodeFunctionCall vclass;
if (base_iface.external_package) {
diff --git a/codegen/valaccodemethodcallmodule.vala b/codegen/valaccodemethodcallmodule.vala
index 48d11eb67..0cbd01ec4 100644
--- a/codegen/valaccodemethodcallmodule.vala
+++ b/codegen/valaccodemethodcallmodule.vala
@@ -108,7 +108,7 @@ public class Vala.CCodeMethodCallModule : CCodeAssignmentModule {
async_call.call = new CCodeMemberAccess.pointer (vcast,
get_ccode_vfunc_name (m));
finish_call.call = new CCodeMemberAccess.pointer (vcast,
get_ccode_finish_vfunc_name (m));
}
- } else if (m != null && m.get_attribute ("NoWrapper") != null && m.binding ==
MemberBinding.INSTANCE && !(m is CreationMethod)) {
+ } else if (m != null && get_ccode_no_wrapper (m) && m.binding ==
MemberBinding.INSTANCE && !(m is CreationMethod)) {
var instance_value = ma.inner.target_value;
if ((ma.member_name == "begin" || ma.member_name == "end") &&
ma.inner.symbol_reference == ma.symbol_reference) {
var inner_ma = (MemberAccess) ma.inner;
diff --git a/codegen/valaccodemethodmodule.vala b/codegen/valaccodemethodmodule.vala
index 6b648cc7f..9777a5013 100644
--- a/codegen/valaccodemethodmodule.vala
+++ b/codegen/valaccodemethodmodule.vala
@@ -157,7 +157,7 @@ public abstract class Vala.CCodeMethodModule : CCodeStructModule {
if (m.is_async_callback) {
return false;
}
- if ((m.is_abstract || m.is_virtual) && m.get_attribute ("NoWrapper") != null) {
+ if ((m.is_abstract || m.is_virtual) && get_ccode_no_wrapper (m)) {
return false;
}
if (add_symbol_declaration (decl_space, m, get_ccode_name (m))) {
@@ -816,7 +816,7 @@ public abstract class Vala.CCodeMethodModule : CCodeStructModule {
pop_context ();
if ((m.is_abstract || m.is_virtual) && !m.coroutine
- && m.get_attribute ("NoWrapper") == null
+ && !get_ccode_no_wrapper (m)
// If the method is a signal handler, the declaration is not needed.
// the name should be reserved for the emitter!
&& m.signal_reference == null) {
diff --git a/codegen/valagasyncmodule.vala b/codegen/valagasyncmodule.vala
index 36270edc3..6c59c7fe4 100644
--- a/codegen/valagasyncmodule.vala
+++ b/codegen/valagasyncmodule.vala
@@ -339,7 +339,7 @@ public class Vala.GAsyncModule : GtkModule {
public override bool generate_method_declaration (Method m, CCodeFile decl_space) {
if (m.coroutine) {
- if ((m.is_abstract || m.is_virtual) && m.get_attribute ("NoWrapper") != null) {
+ if ((m.is_abstract || m.is_virtual) && get_ccode_no_wrapper (m)) {
return false;
}
if (add_symbol_declaration (decl_space, m, get_ccode_name (m))) {
@@ -453,7 +453,7 @@ public class Vala.GAsyncModule : GtkModule {
}
}
- if ((m.is_abstract || m.is_virtual) && m.get_attribute ("NoWrapper") == null) {
+ if ((m.is_abstract || m.is_virtual) && !get_ccode_no_wrapper (m)) {
// generate virtual function wrappers
var cparam_map = new HashMap<int,CCodeParameter> (direct_hash, direct_equal);
var carg_map = new HashMap<int,CCodeExpression> (direct_hash, direct_equal);
diff --git a/codegen/valagirwriter.vala b/codegen/valagirwriter.vala
index e9afd064f..e32e1fdf6 100644
--- a/codegen/valagirwriter.vala
+++ b/codegen/valagirwriter.vala
@@ -1266,7 +1266,7 @@ public class Vala.GIRWriter : CodeVisitor {
tag_name = "function";
}
- if (m.get_attribute ("NoWrapper") == null) {
+ if (!get_ccode_no_wrapper (m)) {
write_signature (m, tag_name, true);
}
@@ -1335,7 +1335,7 @@ public class Vala.GIRWriter : CodeVisitor {
write_indent ();
buffer.append_printf ("<%s name=\"%s\"", tag_name, name);
if (tag_name == "virtual-method") {
- if (m.get_attribute ("NoWrapper") == null) {
+ if (!get_ccode_no_wrapper (m)) {
buffer.append_printf (" invoker=\"%s\"", name);
}
} else if (tag_name == "callback") {
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]