[vala/0.10] Report error when trying to create an array of delegates with targets



commit bfdc9dbbf764aea33553d9a8d311711702fcd8dd
Author: Jürg Billeter <j bitron ch>
Date:   Sat Oct 16 09:32:18 2010 +0200

    Report error when trying to create an array of delegates with targets
    
    Fixes bug 632017.

 codegen/valaccodebasemodule.vala |    6 ++++++
 1 files changed, 6 insertions(+), 0 deletions(-)
---
diff --git a/codegen/valaccodebasemodule.vala b/codegen/valaccodebasemodule.vala
index e263e8f..261ae04 100644
--- a/codegen/valaccodebasemodule.vala
+++ b/codegen/valaccodebasemodule.vala
@@ -4147,6 +4147,12 @@ public class Vala.CCodeBaseModule : CodeGenerator {
 		var array_type = type as ArrayType;
 		if (array_type != null) {
 			check_type (array_type.element_type);
+			if (array_type.element_type is DelegateType) {
+				var delegate_type = (DelegateType) array_type.element_type;
+				if (delegate_type.delegate_symbol.has_target) {
+					Report.error (type.source_reference, "Delegates with target are not supported as array element type");
+				}
+			}
 		}
 		foreach (var type_arg in type.get_type_arguments ()) {
 			check_type (type_arg);



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