[vala] Fix lambda expression regression



commit cfc57beab0816883b1647e24d866fa273fd30d1c
Author: Luca Bruno <lucabru src gnome org>
Date:   Thu Aug 4 21:02:18 2011 +0200

    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.

 codegen/valaccodebasemodule.vala |    8 +++++++-
 vala/valalambdaexpression.vala   |    1 -
 2 files changed, 7 insertions(+), 2 deletions(-)
---
diff --git a/codegen/valaccodebasemodule.vala b/codegen/valaccodebasemodule.vala
index 78a01ce..e1d0525 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 8ad3a08..027beaf 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);



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]