2008-01-22 Juerg Billeter <j@bitron.ch>
* gobject/valaccodegenerator.vala: support length field for array
constants
* tests/arrays.vala: test length field of array constants
svn path=/trunk/; revision=886
2008-01-22 Jürg Billeter <j@bitron.ch>
+ * gobject/valaccodegenerator.vala: support length field for array
+ constants
+
+ * tests/arrays.vala: test length field of array constants
+
+2008-01-22 Jürg Billeter <j@bitron.ch>
+
* tests/Makefile.am, tests/arrays.exp, tests/arrays.vala: add element
access tests to array tests
return length_expr;
}
}
+ } else if (array_expr.symbol_reference is Constant) {
+ var constant = (Constant) array_expr.symbol_reference;
+ var ccall = new CCodeFunctionCall (new CCodeIdentifier ("G_N_ELEMENTS"));
+ ccall.add_argument (new CCodeIdentifier (constant.get_cname ()));
+ return ccall;
}
}
stdout.printf (" 13\n");
}
+ const int[] const_array = { 1, 2, 3 };
+
+ static void test_array_length_of_array_constants () {
+ assert (const_array.length == 3);
+ }
+
static void main (string[] args) {
test_integer_array ();
test_string_array ();
test_array_creation_side_effects ();
test_element_access ();
+
+ test_array_length_of_array_constants ();
}
public static int inc () {