[vala] codegen: Add type check in property vfunc



commit b10c156018783f7bd1c9f28a71297da7988a26b5
Author: Luca Bruno <lucabru src gnome org>
Date:   Sat Aug 27 09:49:29 2011 +0200

    codegen: Add type check in property vfunc
    
    Fixes bug 657481.

 codegen/valaccodebasemodule.vala |    8 ++++++++
 1 files changed, 8 insertions(+), 0 deletions(-)
---
diff --git a/codegen/valaccodebasemodule.vala b/codegen/valaccodebasemodule.vala
index 70a5e68..a62c6ea 100644
--- a/codegen/valaccodebasemodule.vala
+++ b/codegen/valaccodebasemodule.vala
@@ -1499,6 +1499,14 @@ public abstract class Vala.CCodeBaseModule : CodeGenerator {
 
 			push_function (function);
 
+			if (prop.binding == MemberBinding.INSTANCE) {
+				if (!acc.readable || returns_real_struct) {
+					create_property_type_check_statement (prop, false, t, true, "self");
+				} else {
+					create_property_type_check_statement (prop, true, t, true, "self");
+				}
+			}
+
 			CCodeFunctionCall vcast = null;
 			if (prop.parent_symbol is Interface) {
 				var iface = (Interface) prop.parent_symbol;



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