[vala] Support enum values as array indices



commit dcd867956453fe75236fe3c081e2e81e51376967
Author: Jürg Billeter <j bitron ch>
Date:   Fri May 8 14:19:57 2009 +0200

    Support enum values as array indices
---
 vala/valaarraycreationexpression.vala |    2 +-
 vala/valaelementaccess.vala           |    2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/vala/valaarraycreationexpression.vala b/vala/valaarraycreationexpression.vala
index 8b8049c..6181b0f 100644
--- a/vala/valaarraycreationexpression.vala
+++ b/vala/valaarraycreationexpression.vala
@@ -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");
 				}
diff --git a/vala/valaelementaccess.vala b/vala/valaelementaccess.vala
index 2097efa..c22131f 100644
--- a/vala/valaelementaccess.vala
+++ b/vala/valaelementaccess.vala
@@ -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");
 				}



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