[vala/0.46] vala: Improve copy of required attributes from delegate to lamdba method
- From: Rico Tzschichholz <ricotz src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [vala/0.46] vala: Improve copy of required attributes from delegate to lamdba method
- Date: Tue, 24 Mar 2020 09:48:24 +0000 (UTC)
commit a1dc8decce57fdf7acd1ab9b03b9c1bb6f0787f7
Author: Rico Tzschichholz <ricotz ubuntu com>
Date: Tue Mar 17 15:26:36 2020 +0100
vala: Improve copy of required attributes from delegate to lamdba method
codegen/valaccodebasemodule.vala | 5 -----
vala/valalambdaexpression.vala | 8 ++++++++
2 files changed, 8 insertions(+), 5 deletions(-)
---
diff --git a/codegen/valaccodebasemodule.vala b/codegen/valaccodebasemodule.vala
index 9ae993be8..9616cd176 100644
--- a/codegen/valaccodebasemodule.vala
+++ b/codegen/valaccodebasemodule.vala
@@ -5879,11 +5879,6 @@ public abstract class Vala.CCodeBaseModule : CodeGenerator {
public override void visit_lambda_expression (LambdaExpression lambda) {
var delegate_type = (DelegateType) lambda.target_type;
- var d = delegate_type.delegate_symbol;
-
- lambda.method.set_attribute_bool ("CCode", "array_length", get_ccode_array_length (d));
- lambda.method.set_attribute_bool ("CCode", "array_null_terminated",
get_ccode_array_null_terminated (d));
- lambda.method.set_attribute_string ("CCode", "array_length_type", get_ccode_array_length_type
(d));
lambda.accept_children (this);
diff --git a/vala/valalambdaexpression.vala b/vala/valalambdaexpression.vala
index 0c55568ac..a5b96c2a6 100644
--- a/vala/valalambdaexpression.vala
+++ b/vala/valalambdaexpression.vala
@@ -137,6 +137,14 @@ public class Vala.LambdaExpression : Expression {
method.used = true;
method.version.check (source_reference);
+ if (return_type is ArrayType) {
+ method.copy_attribute_bool (cb, "CCode", "array_length");
+ method.copy_attribute_bool (cb, "CCode", "array_null_terminated");
+ method.copy_attribute_string (cb, "CCode", "array_length_type");
+ } else if (return_type is DelegateType) {
+ method.copy_attribute_bool (cb, "CCode", "delegate_target");
+ }
+
if (!cb.has_target || !context.analyzer.is_in_instance_method ()) {
method.binding = MemberBinding.STATIC;
} else {
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]