[vala/0.48] codegen: Fix default value of get_ccode_destroy_notify_pos() and make use of it
- From: Rico Tzschichholz <ricotz src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [vala/0.48] codegen: Fix default value of get_ccode_destroy_notify_pos() and make use of it
- Date: Thu, 8 Apr 2021 07:32:54 +0000 (UTC)
commit 5ef9e29e26db4b3f55e7a6fe6f4ffcd4d546d1e5
Author: Rico Tzschichholz <ricotz ubuntu com>
Date: Tue Apr 6 13:00:16 2021 +0200
codegen: Fix default value of get_ccode_destroy_notify_pos() and make use of it
codegen/valaccode.vala | 7 +------
codegen/valaccodebasemodule.vala | 2 +-
codegen/valaccodedelegatemodule.vala | 12 ++++++------
codegen/valaccodemethodcallmodule.vala | 8 ++++----
codegen/valaccodemethodmodule.vala | 4 ++--
5 files changed, 14 insertions(+), 19 deletions(-)
---
diff --git a/codegen/valaccode.vala b/codegen/valaccode.vala
index 7671b2c50..9b1da33f7 100644
--- a/codegen/valaccode.vala
+++ b/codegen/valaccode.vala
@@ -365,12 +365,7 @@ namespace Vala {
if (a != null && a.has_argument ("destroy_notify_pos")) {
return a.get_double ("destroy_notify_pos");
}
- if (node is Parameter) {
- unowned Parameter param = (Parameter) node;
- return get_ccode_pos (param) + 0.1;
- } else {
- return -3;
- }
+ return get_ccode_delegate_target_pos (node) + 0.01;
}
public static bool get_ccode_delegate_target (CodeNode node) {
diff --git a/codegen/valaccodebasemodule.vala b/codegen/valaccodebasemodule.vala
index 412ec82d4..3124e003a 100644
--- a/codegen/valaccodebasemodule.vala
+++ b/codegen/valaccodebasemodule.vala
@@ -4952,7 +4952,7 @@ public abstract class Vala.CCodeBaseModule : CodeGenerator {
var delegate_target =
get_delegate_target_cexpression (arg, out delegate_target_destroy_notify);
carg_map.set (get_param_pos
(get_ccode_delegate_target_pos (param)), delegate_target);
if (deleg_type.is_disposable ()) {
- carg_map.set (get_param_pos
(get_ccode_delegate_target_pos (param) + 0.01), delegate_target_destroy_notify);
+ carg_map.set (get_param_pos
(get_ccode_destroy_notify_pos (param)), delegate_target_destroy_notify);
}
}
}
diff --git a/codegen/valaccodedelegatemodule.vala b/codegen/valaccodedelegatemodule.vala
index b0770a5a0..dc54d636c 100644
--- a/codegen/valaccodedelegatemodule.vala
+++ b/codegen/valaccodedelegatemodule.vala
@@ -77,7 +77,7 @@ public class Vala.CCodeDelegateModule : CCodeArrayModule {
if (deleg_type.is_disposable ()) {
generate_type_declaration (delegate_target_destroy_type, decl_space);
cparam = new CCodeParameter (get_delegate_target_destroy_notify_cname
("result"), get_ccode_name (delegate_target_destroy_type) + "*");
- cparam_map.set (get_param_pos (get_ccode_delegate_target_pos (d) +
0.01), cparam);
+ cparam_map.set (get_param_pos (get_ccode_destroy_notify_pos (d)),
cparam);
}
}
}
@@ -244,7 +244,7 @@ public class Vala.CCodeDelegateModule : CCodeArrayModule {
cparam_map.set (get_param_pos (get_ccode_delegate_target_pos (d)), cparam);
if (deleg_type.is_disposable ()) {
cparam = new CCodeParameter (get_delegate_target_destroy_notify_cname
("result"), get_ccode_name (delegate_target_destroy_type) + "*");
- cparam_map.set (get_param_pos (get_ccode_delegate_target_pos (d) +
0.01), cparam);
+ cparam_map.set (get_param_pos (get_ccode_destroy_notify_pos (d)),
cparam);
}
}
} else if (d.return_type.is_real_non_null_struct_type ()) {
@@ -343,7 +343,7 @@ public class Vala.CCodeDelegateModule : CCodeArrayModule {
carg_map.set (get_param_pos (get_ccode_delegate_target_pos (param)),
ctarget);
if (deleg_type.is_disposable ()) {
var ctarget_destroy_notify = new CCodeIdentifier
(get_ccode_delegate_target_destroy_notify_name (d_params.get (i)));
- carg_map.set (get_param_pos (get_ccode_delegate_target_pos
(m) + 0.01), ctarget_destroy_notify);
+ carg_map.set (get_param_pos (get_ccode_destroy_notify_pos
(m)), ctarget_destroy_notify);
}
}
}
@@ -369,7 +369,7 @@ public class Vala.CCodeDelegateModule : CCodeArrayModule {
carg_map.set (get_param_pos (get_ccode_delegate_target_pos (m)), ctarget);
if (deleg_type.is_disposable ()) {
var ctarget_destroy_notify = new CCodeIdentifier
(get_delegate_target_destroy_notify_cname ("result"));
- carg_map.set (get_param_pos (get_ccode_delegate_target_pos (m) +
0.01), ctarget_destroy_notify);
+ carg_map.set (get_param_pos (get_ccode_destroy_notify_pos (m)),
ctarget_destroy_notify);
}
}
} else if (m.return_type.is_real_non_null_struct_type ()) {
@@ -488,9 +488,9 @@ public class Vala.CCodeDelegateModule : CCodeArrayModule {
}
if (deleg_type.is_disposable ()) {
cparam = new CCodeParameter
(get_ccode_delegate_target_destroy_notify_name (param), target_destroy_notify_ctypename);
- cparam_map.set (get_param_pos (get_ccode_delegate_target_pos (param)
+ 0.01), cparam);
+ cparam_map.set (get_param_pos (get_ccode_destroy_notify_pos (param)),
cparam);
if (carg_map != null) {
- carg_map.set (get_param_pos (get_ccode_delegate_target_pos
(param) + 0.01), get_cexpression (cparam.name));
+ carg_map.set (get_param_pos (get_ccode_destroy_notify_pos
(param)), get_cexpression (cparam.name));
}
}
}
diff --git a/codegen/valaccodemethodcallmodule.vala b/codegen/valaccodemethodcallmodule.vala
index 461e89735..66f2d8818 100644
--- a/codegen/valaccodemethodcallmodule.vala
+++ b/codegen/valaccodemethodcallmodule.vala
@@ -437,7 +437,7 @@ public class Vala.CCodeMethodCallModule : CCodeAssignmentModule {
carg_map.set (get_param_pos
(get_ccode_delegate_target_pos (param)), delegate_target);
if (deleg_type.is_disposable ()) {
assert
(delegate_target_destroy_notify != null);
- carg_map.set (get_param_pos
(get_ccode_delegate_target_pos (param) + 0.01), delegate_target_destroy_notify);
+ carg_map.set (get_param_pos
(get_ccode_destroy_notify_pos (param)), delegate_target_destroy_notify);
}
}
}
@@ -491,7 +491,7 @@ public class Vala.CCodeMethodCallModule : CCodeAssignmentModule {
temp_var = get_temp_variable
(delegate_target_destroy_type, true, null, true);
emit_temp_var (temp_var);
set_delegate_target_destroy_notify
(arg, get_variable_cexpression (temp_var.name));
- carg_map.set (get_param_pos
(get_ccode_delegate_target_pos (param) + 0.01), new CCodeUnaryExpression (CCodeUnaryOperator.ADDRESS_OF,
get_delegate_target_destroy_notify (arg)));
+ carg_map.set (get_param_pos
(get_ccode_destroy_notify_pos (param)), new CCodeUnaryExpression (CCodeUnaryOperator.ADDRESS_OF,
get_delegate_target_destroy_notify (arg)));
}
}
}
@@ -612,7 +612,7 @@ public class Vala.CCodeMethodCallModule : CCodeAssignmentModule {
emit_temp_var (temp_var);
- out_arg_map.set (get_param_pos (get_ccode_delegate_target_pos (m) +
0.01), new CCodeUnaryExpression (CCodeUnaryOperator.ADDRESS_OF, temp_ref));
+ out_arg_map.set (get_param_pos (get_ccode_destroy_notify_pos (m)),
new CCodeUnaryExpression (CCodeUnaryOperator.ADDRESS_OF, temp_ref));
set_delegate_target_destroy_notify (expr, temp_ref);
} else {
@@ -677,7 +677,7 @@ public class Vala.CCodeMethodCallModule : CCodeAssignmentModule {
emit_temp_var (temp_var);
- out_arg_map.set (get_param_pos (get_ccode_delegate_target_pos (deleg)
+ 0.01), new CCodeUnaryExpression (CCodeUnaryOperator.ADDRESS_OF, temp_ref));
+ out_arg_map.set (get_param_pos (get_ccode_destroy_notify_pos
(deleg)), new CCodeUnaryExpression (CCodeUnaryOperator.ADDRESS_OF, temp_ref));
set_delegate_target_destroy_notify (expr, temp_ref);
}
diff --git a/codegen/valaccodemethodmodule.vala b/codegen/valaccodemethodmodule.vala
index f15c660ee..561b1fbbe 100644
--- a/codegen/valaccodemethodmodule.vala
+++ b/codegen/valaccodemethodmodule.vala
@@ -89,9 +89,9 @@ public abstract class Vala.CCodeMethodModule : CCodeStructModule {
}
if (deleg_type.is_disposable ()) {
cparam = new CCodeParameter (get_delegate_target_destroy_notify_cname
("result"), get_ccode_name (delegate_target_destroy_type) + "*");
- cparam_map.set (get_param_pos (get_ccode_delegate_target_pos (m) +
0.01), cparam);
+ cparam_map.set (get_param_pos (get_ccode_destroy_notify_pos (m)),
cparam);
if (carg_map != null) {
- carg_map.set (get_param_pos (get_ccode_delegate_target_pos
(m) + 0.01), get_cexpression (cparam.name));
+ carg_map.set (get_param_pos (get_ccode_destroy_notify_pos
(m)), get_cexpression (cparam.name));
}
}
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]