]> git.ipfire.org Git - thirdparty/vala.git/commitdiff
Support enum values as array indices
authorJürg Billeter <j@bitron.ch>
Fri, 8 May 2009 12:19:57 +0000 (14:19 +0200)
committerJürg Billeter <j@bitron.ch>
Fri, 8 May 2009 12:19:57 +0000 (14:19 +0200)
vala/valaarraycreationexpression.vala
vala/valaelementaccess.vala

index 8b8049c4fa09cd2afdae19da5a187b1307c6643e..6181b0f6771fb4ce2f88b56239781bf6c7ff52c2 100644 (file)
@@ -193,7 +193,7 @@ public class Vala.ArrayCreationExpression : Expression {
                                if (e.value_type == null) {
                                        /* return on previous error */
                                        return false;
-                               } else if (!(e.value_type is IntegerType)) {
+                               } else if (!(e.value_type is IntegerType || e.value_type is EnumValueType)) {
                                        error = true;
                                        Report.error (e.source_reference, "Expression of integer type expected");
                                }
index 2097efa18ff5aeb9c13ab849a8aaa54302bf3b1f..c22131f7dbaf9a8e7cde0bf860e6c46d3c968fe9 100644 (file)
@@ -187,7 +187,7 @@ public class Vala.ElementAccess : Expression {
                                }
 
                                /* check if the index is of type integer */
-                               if (!(e.value_type is IntegerType)) {
+                               if (!(e.value_type is IntegerType || e.value_type is EnumValueType)) {
                                        error = true;
                                        Report.error (e.source_reference, "Expression of integer type expected");
                                }