[vala/0.46] codegen: Don't call get_ccode_finish_instance() with non-async methods
- From: Rico Tzschichholz <ricotz src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [vala/0.46] codegen: Don't call get_ccode_finish_instance() with non-async methods
- Date: Mon, 22 Jun 2020 09:06:26 +0000 (UTC)
commit b73fdafc98c76ee2d728ba914f80e3b857cf2929
Author: Rico Tzschichholz <ricotz ubuntu com>
Date: Thu Jun 4 08:10:21 2020 +0200
codegen: Don't call get_ccode_finish_instance() with non-async methods
and restrict evaluation of CCode.finish_* attributes to async methods only
codegen/valaccode.vala | 8 ++++++--
codegen/valaccodebasemodule.vala | 2 +-
codegen/valaccodemethodcallmodule.vala | 4 +++-
3 files changed, 10 insertions(+), 4 deletions(-)
---
diff --git a/codegen/valaccode.vala b/codegen/valaccode.vala
index a9b93ce18..75d36b67a 100644
--- a/codegen/valaccode.vala
+++ b/codegen/valaccode.vala
@@ -220,8 +220,9 @@ namespace Vala {
return get_ccode_free_function (sym) == "g_boxed_free";
}
- public static bool get_ccode_finish_instance (CodeNode node) {
- return get_ccode_attribute (node).finish_instance;
+ public static bool get_ccode_finish_instance (Method m) {
+ assert (m.coroutine);
+ return get_ccode_attribute (m).finish_instance;
}
public static string get_ccode_type_id (CodeNode node) {
@@ -412,14 +413,17 @@ namespace Vala {
}
public static string get_ccode_finish_name (Method m) {
+ assert (m.coroutine);
return get_ccode_attribute(m).finish_name;
}
public static string get_ccode_finish_vfunc_name (Method m) {
+ assert (m.coroutine);
return get_ccode_attribute(m).finish_vfunc_name;
}
public static string get_ccode_finish_real_name (Method m) {
+ assert (m.coroutine);
return get_ccode_attribute(m).finish_real_name;
}
diff --git a/codegen/valaccodebasemodule.vala b/codegen/valaccodebasemodule.vala
index 696e82cd3..0cee17e8f 100644
--- a/codegen/valaccodebasemodule.vala
+++ b/codegen/valaccodebasemodule.vala
@@ -5034,7 +5034,7 @@ public abstract class Vala.CCodeBaseModule : CodeGenerator {
}
}
- if (m != null && m.parent_symbol is Class) {
+ if (m != null && m.coroutine && m.parent_symbol is Class) {
if (get_ccode_finish_instance (m)) {
var tmp = new CCodeMemberAccess.pointer (new CCodeIdentifier
("_data_"), "_source_object_");
out_arg_map.set (get_param_pos (get_ccode_instance_pos (m)), tmp);
diff --git a/codegen/valaccodemethodcallmodule.vala b/codegen/valaccodemethodcallmodule.vala
index 2b7cefb4a..c672faa69 100644
--- a/codegen/valaccodemethodcallmodule.vala
+++ b/codegen/valaccodemethodcallmodule.vala
@@ -231,7 +231,9 @@ public class Vala.CCodeMethodCallModule : CCodeAssignmentModule {
instance = new CCodeUnaryExpression (CCodeUnaryOperator.ADDRESS_OF,
get_cvalue_ (instance_value));
}
- if (expr.is_yield_expression) {
+ if (!m.coroutine) {
+ in_arg_map.set (get_param_pos (get_ccode_instance_pos (m)), instance);
+ } else if (expr.is_yield_expression) {
in_arg_map.set (get_param_pos (get_ccode_instance_pos (m)), instance);
if (get_ccode_finish_instance (m)) {
out_arg_map.set (get_param_pos (get_ccode_instance_pos (m)),
instance);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]