From: Jürg Billeter Date: Mon, 30 Apr 2007 09:45:42 +0000 (+0000) Subject: allow any integer type as index in an element access expression, fixes bug X-Git-Tag: VALA_0_0_9~3 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=06ef9db4f3d4cc964082ad8edb779fb724db431e;p=thirdparty%2Fvala.git allow any integer type as index in an element access expression, fixes bug 2007-04-30 Jürg Billeter * vala/valasemanticanalyzer.vala: allow any integer type as index in an element access expression, fixes bug 434506 svn path=/trunk/; revision=293 --- diff --git a/vala/ChangeLog b/vala/ChangeLog index c7971b56d..7d7f3f698 100644 --- a/vala/ChangeLog +++ b/vala/ChangeLog @@ -1,3 +1,8 @@ +2007-04-30 Jürg Billeter + + * vala/valasemanticanalyzer.vala: allow any integer type as index in an + element access expression, fixes bug 434506 + 2007-04-30 Jürg Billeter * vala/parser.y, vala/valasymbolbuilder.vala, diff --git a/vala/vala/valasemanticanalyzer.vala b/vala/vala/valasemanticanalyzer.vala index 39e5582d9..6cf9cf5a4 100644 --- a/vala/vala/valasemanticanalyzer.vala +++ b/vala/vala/valasemanticanalyzer.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"); } } }