]> git.ipfire.org Git - thirdparty/vala.git/commitdiff
allow any integer type as index in an element access expression, fixes bug
authorJürg Billeter <j@bitron.ch>
Mon, 30 Apr 2007 09:45:42 +0000 (09:45 +0000)
committerJürg Billeter <juergbi@src.gnome.org>
Mon, 30 Apr 2007 09:45:42 +0000 (09:45 +0000)
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

vala/ChangeLog
vala/vala/valasemanticanalyzer.vala

index c7971b56d483817d4d1f42794665c41050ea9010..7d7f3f698d3dfc18ba17d8cc3d8831b91dadfe5b 100644 (file)
@@ -1,3 +1,8 @@
+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,
index 39e5582d90f7a3b427b5002b2df9879fd494e9b7..6cf9cf5a412324d2f64d93a631916a6b32dc93dd 100644 (file)
@@ -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");
                        }
                }
        }