]> git.ipfire.org Git - thirdparty/vala.git/commitdiff
fix assignment of integer literals to derived integer types, fixes bug
authorJuerg Billeter <j@bitron.ch>
Sun, 11 May 2008 11:06:29 +0000 (11:06 +0000)
committerJürg Billeter <juergbi@src.gnome.org>
Sun, 11 May 2008 11:06:29 +0000 (11:06 +0000)
2008-05-11  Juerg Billeter  <j@bitron.ch>

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

svn path=/trunk/; revision=1364

ChangeLog
vala/valaintegertype.vala

index 40b609b46b85248deb4981f21b5882876191fe86..1db65f0f42c952fee9beae1cdd07d42580526b0c 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,8 @@
+2008-05-11  Jürg Billeter  <j@bitron.ch>
+
+       * vala/valaintegertype.vala: fix assignment of integer literals to
+       derived integer types, fixes bug 530809
+
 2008-05-11  Jürg Billeter  <j@bitron.ch>
 
        * vapi/packages/gtk+-2.0/: fix gtk_message_dialog_new* bindings,
index b2bee554ab58802260ec31f711aad02be28c9617..acc7f6866006492c43d7bbe42fbb9943a031538f 100644 (file)
@@ -47,9 +47,12 @@ public class Vala.IntegerType : ValueType {
                        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") {