]> git.ipfire.org Git - thirdparty/vala.git/commitdiff
Fix lambda expression regression
authorLuca Bruno <lucabru@src.gnome.org>
Thu, 4 Aug 2011 19:02:18 +0000 (21:02 +0200)
committerLuca Bruno <lucabru@src.gnome.org>
Thu, 4 Aug 2011 19:04:18 +0000 (21:04 +0200)
The regression was introduced by commit fec66bf087618263c57.
Instead of making a shallow copy of all attributes, the ccode bits
are now moved to the codegen in order to reflect the original code.

codegen/valaccodebasemodule.vala
vala/valalambdaexpression.vala

index 78a01ce483f9524a1bb7facad29e455b552a5e69..e1d05257b9f14a408eedd1bdfed40120d8bac292 100644 (file)
@@ -4951,13 +4951,19 @@ 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", d.get_attribute_bool ("CCode", "array_length"));
+               lambda.method.set_attribute_bool ("CCode", "array_null_terminated", d.get_attribute_bool ("CCode", "array_null_terminated"));
+               lambda.method.set_attribute_string ("CCode", "array_length_type", d.get_attribute_string ("CCode", "array_length_type"));
+
                lambda.accept_children (this);
 
                bool expr_owned = lambda.value_type.value_owned;
 
                set_cvalue (lambda, new CCodeIdentifier (get_ccode_name (lambda.method)));
 
-               var delegate_type = (DelegateType) lambda.target_type;
                if (lambda.method.closure) {
                        int block_id = get_block_id (current_closure_block);
                        var delegate_target = get_variable_cexpression ("_data%d_".printf (block_id));
index 8ad3a08343d568e1f80905999330688dc60ee3ae..027beaf0577b529f5c740a6f9da7b9f281dfe3b4 100644 (file)
@@ -135,7 +135,6 @@ public class Vala.LambdaExpression : Expression {
                var cb = (Delegate) ((DelegateType) target_type).delegate_symbol;
                var return_type = cb.return_type.get_actual_type (target_type, null, this);
                method = new Method (get_lambda_name (context), return_type, source_reference);
-               method.attributes = cb.attributes.copy ();
                // track usage for flow analyzer
                method.used = true;
                method.check_deprecated (source_reference);