Commit 06ef9db4 authored by Jürg Billeter's avatar Jürg Billeter Committed by Jürg Billeter

allow any integer type as index in an element access expression, fixes bug

2007-04-30  Jürg Billeter  <j@bitron.ch>

	* vala/valasemanticanalyzer.vala: allow any integer type as index in an
	  element access expression, fixes bug 434506

svn path=/trunk/; revision=293
parent 612e05c3
2007-04-30 Jürg Billeter <j@bitron.ch>
* vala/valasemanticanalyzer.vala: allow any integer type as index in an
element access expression, fixes bug 434506
2007-04-30 Jürg Billeter <j@bitron.ch>
* vala/parser.y, vala/valasymbolbuilder.vala,
......
......@@ -868,9 +868,9 @@ public class Vala.SemanticAnalyzer : CodeVisitor {
if (e.static_type == null) {
/* return on previous error */
return;
} else if (e.static_type.data_type != int_type.data_type) {
} else if (!(e.static_type.data_type is Struct) || !((Struct) e.static_type.data_type).is_integer_type ()) {
expr.error = true;
Report.error (e.source_reference, "Expected expression of type ´int'");
Report.error (e.source_reference, "Expression of integer type expected");
}
}
......@@ -1392,9 +1392,9 @@ public class Vala.SemanticAnalyzer : CodeVisitor {
}
/* check if the index is of type integer */
if (e.static_type.data_type != int_type.data_type && e.static_type.data_type != uint_type.data_type) {
if (!(e.static_type.data_type is Struct) || !((Struct) e.static_type.data_type).is_integer_type ()) {
expr.error = true;
Report.error (e.source_reference, "Expression of type `int' or `uint` 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