Commit 361d2179 authored by Jürg Billeter's avatar Jürg Billeter Committed by Jürg Billeter
Browse files

support array length parameters in virtual methods

2007-07-30  Juerg Billeter  <j@bitron.ch>

	* gobject/valacodegeneratormethod.vala: support array length parameters
	  in virtual methods

svn path=/trunk/; revision=414
parent 35b9fdd8
2007-07-30 Jürg Billeter <j@bitron.ch>
* gobject/valacodegeneratormethod.vala: support array length parameters
in virtual methods
2007-07-30 Jürg Billeter <j@bitron.ch>
* vala/valasemanticanalyzer.vala: fix warning when defining abstract
......
......@@ -337,10 +337,36 @@ public class Vala.CodeGenerator {
var params = m.get_parameters ();
foreach (FormalParameter param in params) {
if (!param.no_array_length && param.type_reference.data_type is Array) {
var arr = (Array) param.type_reference.data_type;
var length_ctype = "int";
if (param.type_reference.is_out) {
length_ctype = "int*";
}
for (int dim = 1; dim <= arr.rank; dim++) {
var cparam = new CCodeFormalParameter (get_array_length_cname (param.name, dim), length_ctype);
vfunc.add_parameter (cparam);
vcall.add_argument (new CCodeIdentifier (cparam.name));
}
}
vfunc.add_parameter ((CCodeFormalParameter) param.ccodenode);
vcall.add_argument (new CCodeIdentifier (param.name));
}
// return array length if appropriate
if (!m.no_array_length && m.return_type.data_type is Array) {
var arr = (Array) m.return_type.data_type;
for (int dim = 1; dim <= arr.rank; dim++) {
var cparam = new CCodeFormalParameter (get_array_length_cname ("result", dim), "int*");
vfunc.add_parameter (cparam);
vcall.add_argument (new CCodeIdentifier (cparam.name));
}
}
if (m.return_type.data_type == null) {
vblock.add_statement (new CCodeExpressionStatement (vcall));
} else {
......
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