vala r1364 - in trunk: . vala



Author: juergbi
Date: Sun May 11 11:06:29 2008
New Revision: 1364
URL: http://svn.gnome.org/viewvc/vala?rev=1364&view=rev

Log:
2008-05-11  Juerg Billeter  <j bitron ch>

	* vala/valaintegertype.vala: fix assignment of integer literals to
	derived integer types, fixes bug 530809


Modified:
   trunk/ChangeLog
   trunk/vala/valaintegertype.vala

Modified: trunk/vala/valaintegertype.vala
==============================================================================
--- trunk/vala/valaintegertype.vala	(original)
+++ trunk/vala/valaintegertype.vala	Sun May 11 11:06:29 2008
@@ -47,9 +47,12 @@
 			var target_st = (Struct) target_type.data_type;
 			if (target_st.is_integer_type ()) {
 				var int_attr = target_st.get_attribute ("IntegerType");
-				if (int_attr.has_argument ("min") && int_attr.has_argument ("max")) {
+				if (int_attr != null && int_attr.has_argument ("min") && int_attr.has_argument ("max")) {
 					int val = literal.value.to_int ();
 					return (val >= int_attr.get_integer ("min") && val <= int_attr.get_integer ("max"));
+				} else {
+					// assume to be compatible if the target type doesn't specify limits
+					return true;
 				}
 			}
 		} else if (target_type.data_type is Enum && literal.get_type_name () == "int") {



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