From: Luca Bruno Date: Thu, 4 Aug 2011 19:02:18 +0000 (+0200) Subject: Fix lambda expression regression X-Git-Tag: 0.13.2~30 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=cfc57beab0816883b1647e24d866fa273fd30d1c;p=thirdparty%2Fvala.git Fix lambda expression regression 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. --- diff --git a/codegen/valaccodebasemodule.vala b/codegen/valaccodebasemodule.vala index 78a01ce48..e1d05257b 100644 --- a/codegen/valaccodebasemodule.vala +++ b/codegen/valaccodebasemodule.vala @@ -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)); diff --git a/vala/valalambdaexpression.vala b/vala/valalambdaexpression.vala index 8ad3a0834..027beaf05 100644 --- a/vala/valalambdaexpression.vala +++ b/vala/valalambdaexpression.vala @@ -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);