Commit dcd86795 authored by Jürg Billeter's avatar Jürg Billeter

Support enum values as array indices

parent 1fe4e1b7
...@@ -193,7 +193,7 @@ public class Vala.ArrayCreationExpression : Expression { ...@@ -193,7 +193,7 @@ public class Vala.ArrayCreationExpression : Expression {
if (e.value_type == null) { if (e.value_type == null) {
/* return on previous error */ /* return on previous error */
return false; return false;
} else if (!(e.value_type is IntegerType)) { } else if (!(e.value_type is IntegerType || e.value_type is EnumValueType)) {
error = true; error = true;
Report.error (e.source_reference, "Expression of integer type expected"); Report.error (e.source_reference, "Expression of integer type expected");
} }
......
...@@ -187,7 +187,7 @@ public class Vala.ElementAccess : Expression { ...@@ -187,7 +187,7 @@ public class Vala.ElementAccess : Expression {
} }
/* check if the index is of type integer */ /* 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; error = true;
Report.error (e.source_reference, "Expression of integer type expected"); Report.error (e.source_reference, "Expression of integer type expected");
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment