Commit e81776c0 authored by Jürg Billeter's avatar Jürg Billeter

Rename FormalParameter to Parameter

parent 5f3ed0f4
......@@ -33,7 +33,6 @@ libvalaccode_la_VALASOURCES = \
valaccodeexpression.vala \
valaccodeexpressionstatement.vala \
valaccodefile.vala \
valaccodeformalparameter.vala \
valaccodeforstatement.vala \
valaccodefragment.vala \
valaccodefunction.vala \
......@@ -53,6 +52,7 @@ libvalaccode_la_VALASOURCES = \
valaccodenewline.vala \
valaccodenode.vala \
valaccodeoncesection.vala \
valaccodeparameter.vala \
valaccodeparenthesizedexpression.vala \
valaccodereturnstatement.vala \
valaccodestatement.vala \
......
......@@ -50,7 +50,7 @@ public class Vala.CCodeFunction : CCodeNode {
*/
public CCodeBlock block { get; set; }
private List<CCodeFormalParameter> parameters = new ArrayList<CCodeFormalParameter> ();
private List<CCodeParameter> parameters = new ArrayList<CCodeParameter> ();
CCodeBlock current_block;
List<CCodeStatement> statement_stack = new ArrayList<CCodeStatement> ();
......@@ -67,11 +67,11 @@ public class Vala.CCodeFunction : CCodeNode {
*
* @param param a formal parameter
*/
public void add_parameter (CCodeFormalParameter param) {
public void add_parameter (CCodeParameter param) {
parameters.add (param);
}
public void insert_parameter (int position, CCodeFormalParameter param) {
public void insert_parameter (int position, CCodeParameter param) {
parameters.insert (position, param);
}
......@@ -88,7 +88,7 @@ public class Vala.CCodeFunction : CCodeNode {
/* no deep copy for lists available yet
* func.parameters = parameters.copy ();
*/
foreach (CCodeFormalParameter param in parameters) {
foreach (CCodeParameter param in parameters) {
func.parameters.add (param);
}
......@@ -111,7 +111,7 @@ public class Vala.CCodeFunction : CCodeNode {
writer.write_string (" (");
bool first = true;
foreach (CCodeFormalParameter param in parameters) {
foreach (CCodeParameter param in parameters) {
if (!first) {
writer.write_string (", ");
} else {
......
......@@ -31,7 +31,7 @@ public class Vala.CCodeFunctionDeclarator : CCodeDeclarator {
*/
public string name { get; set; }
private List<CCodeFormalParameter> parameters = new ArrayList<CCodeFormalParameter> ();
private List<CCodeParameter> parameters = new ArrayList<CCodeParameter> ();
public CCodeFunctionDeclarator (string name) {
this.name = name;
......@@ -42,7 +42,7 @@ public class Vala.CCodeFunctionDeclarator : CCodeDeclarator {
*
* @param param a formal parameter
*/
public void add_parameter (CCodeFormalParameter param) {
public void add_parameter (CCodeParameter param) {
parameters.add (param);
}
......@@ -56,7 +56,7 @@ public class Vala.CCodeFunctionDeclarator : CCodeDeclarator {
writer.write_string (") (");
bool first = true;
foreach (CCodeFormalParameter param in parameters) {
foreach (CCodeParameter param in parameters) {
if (!first) {
writer.write_string (", ");
} else {
......
/* valaccodeformalparameter.vala
/* valaccodeparameter.vala
*
* Copyright (C) 2006-2008 Jürg Billeter
*
......@@ -25,7 +25,7 @@ using GLib;
/**
* Represents a formal parameter in a C method signature.
*/
public class Vala.CCodeFormalParameter : CCodeNode {
public class Vala.CCodeParameter : CCodeNode {
/**
* The parameter name.
*/
......@@ -42,12 +42,12 @@ public class Vala.CCodeFormalParameter : CCodeNode {
*/
public bool ellipsis { get; set; }
public CCodeFormalParameter (string n, string type) {
public CCodeParameter (string n, string type) {
name = n;
type_name = type;
}
public CCodeFormalParameter.with_ellipsis () {
public CCodeParameter.with_ellipsis () {
ellipsis = true;
}
......
......@@ -126,7 +126,7 @@ public class Vala.CCodeArrayModule : CCodeMethodCallModule {
return "%s_length%d".printf (array_cname, dim);
}
public override string get_parameter_array_length_cname (FormalParameter param, int dim) {
public override string get_parameter_array_length_cname (Parameter param, int dim) {
if (param.has_array_length_cname) {
return param.get_array_length_cname ();
} else {
......@@ -257,8 +257,8 @@ public class Vala.CCodeArrayModule : CCodeMethodCallModule {
var fun = new CCodeFunction (cname, "void");
fun.modifiers = CCodeModifiers.STATIC;
fun.add_parameter (new CCodeFormalParameter ("array", "%s*".printf (st.get_cname ())));
fun.add_parameter (new CCodeFormalParameter ("array_length", "gint"));
fun.add_parameter (new CCodeParameter ("array", "%s*".printf (st.get_cname ())));
fun.add_parameter (new CCodeParameter ("array_length", "gint"));
push_function (fun);
......@@ -306,9 +306,9 @@ public class Vala.CCodeArrayModule : CCodeMethodCallModule {
var fun = new CCodeFunction ("_vala_array_destroy", "void");
fun.modifiers = CCodeModifiers.STATIC;
fun.add_parameter (new CCodeFormalParameter ("array", "gpointer"));
fun.add_parameter (new CCodeFormalParameter ("array_length", "gint"));
fun.add_parameter (new CCodeFormalParameter ("destroy_func", "GDestroyNotify"));
fun.add_parameter (new CCodeParameter ("array", "gpointer"));
fun.add_parameter (new CCodeParameter ("array_length", "gint"));
fun.add_parameter (new CCodeParameter ("destroy_func", "GDestroyNotify"));
push_function (fun);
......@@ -330,9 +330,9 @@ public class Vala.CCodeArrayModule : CCodeMethodCallModule {
fun = new CCodeFunction ("_vala_array_free", "void");
fun.modifiers = CCodeModifiers.STATIC;
fun.add_parameter (new CCodeFormalParameter ("array", "gpointer"));
fun.add_parameter (new CCodeFormalParameter ("array_length", "gint"));
fun.add_parameter (new CCodeFormalParameter ("destroy_func", "GDestroyNotify"));
fun.add_parameter (new CCodeParameter ("array", "gpointer"));
fun.add_parameter (new CCodeParameter ("array_length", "gint"));
fun.add_parameter (new CCodeParameter ("destroy_func", "GDestroyNotify"));
push_function (fun);
......@@ -360,11 +360,11 @@ public class Vala.CCodeArrayModule : CCodeMethodCallModule {
// FIXME will leak memory if that's not the case
var fun = new CCodeFunction ("_vala_array_move", "void");
fun.modifiers = CCodeModifiers.STATIC;
fun.add_parameter (new CCodeFormalParameter ("array", "gpointer"));
fun.add_parameter (new CCodeFormalParameter ("element_size", "gsize"));
fun.add_parameter (new CCodeFormalParameter ("src", "gint"));
fun.add_parameter (new CCodeFormalParameter ("dest", "gint"));
fun.add_parameter (new CCodeFormalParameter ("length", "gint"));
fun.add_parameter (new CCodeParameter ("array", "gpointer"));
fun.add_parameter (new CCodeParameter ("element_size", "gsize"));
fun.add_parameter (new CCodeParameter ("src", "gint"));
fun.add_parameter (new CCodeParameter ("dest", "gint"));
fun.add_parameter (new CCodeParameter ("length", "gint"));
push_function (fun);
......@@ -410,7 +410,7 @@ public class Vala.CCodeArrayModule : CCodeMethodCallModule {
public override void append_vala_array_length () {
var fun = new CCodeFunction ("_vala_array_length", "gint");
fun.modifiers = CCodeModifiers.STATIC;
fun.add_parameter (new CCodeFormalParameter ("array", "gpointer"));
fun.add_parameter (new CCodeParameter ("array", "gpointer"));
push_function (fun);
......@@ -514,13 +514,13 @@ public class Vala.CCodeArrayModule : CCodeMethodCallModule {
var function = new CCodeFunction (dup_func, array_type.get_cname ());
function.modifiers = CCodeModifiers.STATIC;
function.add_parameter (new CCodeFormalParameter ("self", array_type.get_cname ()));
function.add_parameter (new CCodeParameter ("self", array_type.get_cname ()));
// total length over all dimensions
function.add_parameter (new CCodeFormalParameter ("length", "int"));
function.add_parameter (new CCodeParameter ("length", "int"));
if (array_type.element_type is GenericType) {
// dup function array elements
string func_name = "%s_dup_func".printf (array_type.element_type.type_parameter.name.down ());
function.add_parameter (new CCodeFormalParameter (func_name, "GBoxedCopyFunc"));
function.add_parameter (new CCodeParameter (func_name, "GBoxedCopyFunc"));
}
// definition
......@@ -587,8 +587,8 @@ public class Vala.CCodeArrayModule : CCodeMethodCallModule {
var function = new CCodeFunction (dup_func, "void");
function.modifiers = CCodeModifiers.STATIC;
function.add_parameter (new CCodeFormalParameter ("self", array_type.get_cname () + "*"));
function.add_parameter (new CCodeFormalParameter ("dest", array_type.get_cname () + "*"));
function.add_parameter (new CCodeParameter ("self", array_type.get_cname () + "*"));
function.add_parameter (new CCodeParameter ("dest", array_type.get_cname () + "*"));
// definition
......@@ -639,9 +639,9 @@ public class Vala.CCodeArrayModule : CCodeMethodCallModule {
var function = new CCodeFunction (add_func, "void");
function.modifiers = CCodeModifiers.STATIC;
function.add_parameter (new CCodeFormalParameter ("array", array_type.get_cname () + "*"));
function.add_parameter (new CCodeFormalParameter ("length", "int*"));
function.add_parameter (new CCodeFormalParameter ("size", "int*"));
function.add_parameter (new CCodeParameter ("array", array_type.get_cname () + "*"));
function.add_parameter (new CCodeParameter ("length", "int*"));
function.add_parameter (new CCodeParameter ("size", "int*"));
push_function (function);
......@@ -656,7 +656,7 @@ public class Vala.CCodeArrayModule : CCodeMethodCallModule {
value = new CCodeUnaryExpression (CCodeUnaryOperator.POINTER_INDIRECTION, value);
}
}
function.add_parameter (new CCodeFormalParameter ("value", typename));
function.add_parameter (new CCodeParameter ("value", typename));
var array = new CCodeUnaryExpression (CCodeUnaryOperator.POINTER_INDIRECTION, new CCodeIdentifier ("array"));
var length = new CCodeUnaryExpression (CCodeUnaryOperator.POINTER_INDIRECTION, new CCodeIdentifier ("length"));
......@@ -728,7 +728,7 @@ public class Vala.CCodeArrayModule : CCodeMethodCallModule {
return;
}
var value_param = new FormalParameter ("value", element.target_type);
var value_param = new Parameter ("value", element.target_type);
var ccall = new CCodeFunctionCall (new CCodeIdentifier (generate_array_add_wrapper (array_type)));
ccall.add_argument (new CCodeUnaryExpression (CCodeUnaryOperator.ADDRESS_OF, get_cvalue (array)));
......@@ -739,7 +739,7 @@ public class Vala.CCodeArrayModule : CCodeMethodCallModule {
set_cvalue (assignment, ccall);
}
public override CCodeFormalParameter generate_parameter (FormalParameter param, CCodeFile decl_space, Map<int,CCodeFormalParameter> cparam_map, Map<int,CCodeExpression>? carg_map) {
public override CCodeParameter generate_parameter (Parameter param, CCodeFile decl_space, Map<int,CCodeParameter> cparam_map, Map<int,CCodeExpression>? carg_map) {
if (!(param.variable_type is ArrayType)) {
return base.generate_parameter (param, decl_space, cparam_map, carg_map);
}
......@@ -750,7 +750,7 @@ public class Vala.CCodeArrayModule : CCodeMethodCallModule {
ctypename += "*";
}
var main_cparam = new CCodeFormalParameter (get_variable_cname (param.name), ctypename);
var main_cparam = new CCodeParameter (get_variable_cname (param.name), ctypename);
var array_type = (ArrayType) param.variable_type;
......@@ -771,7 +771,7 @@ public class Vala.CCodeArrayModule : CCodeMethodCallModule {
}
for (int dim = 1; dim <= array_type.rank; dim++) {
var cparam = new CCodeFormalParameter (get_parameter_array_length_cname (param, dim), length_ctype);
var cparam = new CCodeParameter (get_parameter_array_length_cname (param, dim), length_ctype);
cparam_map.set (get_param_pos (param.carray_length_parameter_position + 0.01 * dim), cparam);
if (carg_map != null) {
carg_map.set (get_param_pos (param.carray_length_parameter_position + 0.01 * dim), get_variable_cexpression (cparam.name));
......
This diff is collapsed.
......@@ -47,8 +47,8 @@ public class Vala.CCodeDelegateModule : CCodeArrayModule {
}
var cfundecl = new CCodeFunctionDeclarator (d.get_cname ());
foreach (FormalParameter param in d.get_parameters ()) {
var cparam = generate_parameter (param, decl_space, new HashMap<int,CCodeFormalParameter> (), null);
foreach (Parameter param in d.get_parameters ()) {
var cparam = generate_parameter (param, decl_space, new HashMap<int,CCodeParameter> (), null);
cfundecl.add_parameter (cparam);
......@@ -62,7 +62,7 @@ public class Vala.CCodeDelegateModule : CCodeArrayModule {
}
for (int dim = 1; dim <= array_type.rank; dim++) {
cparam = new CCodeFormalParameter (get_parameter_array_length_cname (param, dim), length_ctype);
cparam = new CCodeParameter (get_parameter_array_length_cname (param, dim), length_ctype);
cfundecl.add_parameter (cparam);
}
}
......@@ -71,7 +71,7 @@ public class Vala.CCodeDelegateModule : CCodeArrayModule {
var deleg_type = (DelegateType) param.variable_type;
var param_d = deleg_type.delegate_symbol;
if (param_d.has_target) {
cparam = new CCodeFormalParameter (get_delegate_target_cname (get_variable_cname (param.name)), "void*");
cparam = new CCodeParameter (get_delegate_target_cname (get_variable_cname (param.name)), "void*");
cfundecl.add_parameter (cparam);
}
}
......@@ -81,7 +81,7 @@ public class Vala.CCodeDelegateModule : CCodeArrayModule {
var array_type = (ArrayType) d.return_type;
for (int dim = 1; dim <= array_type.rank; dim++) {
var cparam = new CCodeFormalParameter (get_array_length_cname ("result", dim), "int*");
var cparam = new CCodeParameter (get_array_length_cname ("result", dim), "int*");
cfundecl.add_parameter (cparam);
}
} else if (d.return_type is DelegateType) {
......@@ -89,19 +89,19 @@ public class Vala.CCodeDelegateModule : CCodeArrayModule {
var deleg_type = (DelegateType) d.return_type;
var result_d = deleg_type.delegate_symbol;
if (result_d.has_target) {
var cparam = new CCodeFormalParameter (get_delegate_target_cname ("result"), "void**");
var cparam = new CCodeParameter (get_delegate_target_cname ("result"), "void**");
cfundecl.add_parameter (cparam);
}
} else if (d.return_type.is_real_non_null_struct_type ()) {
var cparam = new CCodeFormalParameter ("result", "%s*".printf (d.return_type.get_cname ()));
var cparam = new CCodeParameter ("result", "%s*".printf (d.return_type.get_cname ()));
cfundecl.add_parameter (cparam);
}
if (d.has_target) {
var cparam = new CCodeFormalParameter ("user_data", "void*");
var cparam = new CCodeParameter ("user_data", "void*");
cfundecl.add_parameter (cparam);
}
if (d.get_error_types ().size > 0) {
var cparam = new CCodeFormalParameter ("error", "GError**");
var cparam = new CCodeParameter ("error", "GError**");
cfundecl.add_parameter (cparam);
}
......@@ -195,20 +195,20 @@ public class Vala.CCodeDelegateModule : CCodeArrayModule {
var function = new CCodeFunction (wrapper_name, return_type_cname);
function.modifiers = CCodeModifiers.STATIC;
var cparam_map = new HashMap<int,CCodeFormalParameter> (direct_hash, direct_equal);
var cparam_map = new HashMap<int,CCodeParameter> (direct_hash, direct_equal);
if (d.has_target) {
var cparam = new CCodeFormalParameter ("self", "gpointer");
var cparam = new CCodeParameter ("self", "gpointer");
cparam_map.set (get_param_pos (d.cinstance_parameter_position), cparam);
}
if (d.sender_type != null) {
var param = new FormalParameter ("_sender", d.sender_type);
var param = new Parameter ("_sender", d.sender_type);
generate_parameter (param, cfile, cparam_map, null);
}
var d_params = d.get_parameters ();
foreach (FormalParameter param in d_params) {
foreach (Parameter param in d_params) {
if (dynamic_sig != null
&& param.variable_type is ArrayType
&& ((ArrayType) param.variable_type).element_type.data_type == string_type.data_type) {
......@@ -224,7 +224,7 @@ public class Vala.CCodeDelegateModule : CCodeArrayModule {
var array_type = (ArrayType) d.return_type;
for (int dim = 1; dim <= array_type.rank; dim++) {
var cparam = new CCodeFormalParameter (get_array_length_cname ("result", dim), "int*");
var cparam = new CCodeParameter (get_array_length_cname ("result", dim), "int*");
cparam_map.set (get_param_pos (d.carray_length_parameter_position + 0.01 * dim), cparam);
}
} else if (d.return_type is DelegateType) {
......@@ -232,16 +232,16 @@ public class Vala.CCodeDelegateModule : CCodeArrayModule {
var deleg_type = (DelegateType) d.return_type;
if (deleg_type.delegate_symbol.has_target) {
var cparam = new CCodeFormalParameter (get_delegate_target_cname ("result"), "void**");
var cparam = new CCodeParameter (get_delegate_target_cname ("result"), "void**");
cparam_map.set (get_param_pos (d.cdelegate_target_parameter_position), cparam);
}
} else if (d.return_type.is_real_non_null_struct_type ()) {
var cparam = new CCodeFormalParameter ("result", "%s*".printf (d.return_type.get_cname ()));
var cparam = new CCodeParameter ("result", "%s*".printf (d.return_type.get_cname ()));
cparam_map.set (get_param_pos (-3), cparam);
}
if (m.get_error_types ().size > 0) {
var cparam = new CCodeFormalParameter ("error", "GError**");
var cparam = new CCodeParameter ("error", "GError**");
cparam_map.set (get_param_pos (-1), cparam);
}
......@@ -287,7 +287,7 @@ public class Vala.CCodeDelegateModule : CCodeArrayModule {
bool first = true;
foreach (FormalParameter param in m.get_parameters ()) {
foreach (Parameter param in m.get_parameters ()) {
if (first && d.sender_type != null && m.get_parameters ().size == d.get_parameters ().size + 1) {
// sender parameter
carg_map.set (get_param_pos (param.cparameter_position), new CCodeIdentifier ("_sender"));
......@@ -424,7 +424,7 @@ public class Vala.CCodeDelegateModule : CCodeArrayModule {
return wrapper_name;
}
public override CCodeFormalParameter generate_parameter (FormalParameter param, CCodeFile decl_space, Map<int,CCodeFormalParameter> cparam_map, Map<int,CCodeExpression>? carg_map) {
public override CCodeParameter generate_parameter (Parameter param, CCodeFile decl_space, Map<int,CCodeParameter> cparam_map, Map<int,CCodeExpression>? carg_map) {
if (!(param.variable_type is DelegateType || param.variable_type is MethodType)) {
return base.generate_parameter (param, decl_space, cparam_map, carg_map);
}
......@@ -445,7 +445,7 @@ public class Vala.CCodeDelegateModule : CCodeArrayModule {
target_destroy_notify_ctypename += "*";
}
var main_cparam = new CCodeFormalParameter (get_variable_cname (param.name), ctypename);
var main_cparam = new CCodeParameter (get_variable_cname (param.name), ctypename);
cparam_map.set (get_param_pos (param.cparameter_position), main_cparam);
if (carg_map != null) {
......@@ -459,13 +459,13 @@ public class Vala.CCodeDelegateModule : CCodeArrayModule {
generate_delegate_declaration (d, decl_space);
if (d.has_target) {
var cparam = new CCodeFormalParameter (get_delegate_target_cname (get_variable_cname (param.name)), target_ctypename);
var cparam = new CCodeParameter (get_delegate_target_cname (get_variable_cname (param.name)), target_ctypename);
cparam_map.set (get_param_pos (param.cdelegate_target_parameter_position), cparam);
if (carg_map != null) {
carg_map.set (get_param_pos (param.cdelegate_target_parameter_position), get_variable_cexpression (cparam.name));
}
if (deleg_type.value_owned) {
cparam = new CCodeFormalParameter (get_delegate_target_destroy_notify_cname (get_variable_cname (param.name)), target_destroy_notify_ctypename);
cparam = new CCodeParameter (get_delegate_target_destroy_notify_cname (get_variable_cname (param.name)), target_destroy_notify_ctypename);
cparam_map.set (get_param_pos (param.cdelegate_target_parameter_position + 0.01), cparam);
if (carg_map != null) {
carg_map.set (get_param_pos (param.cdelegate_target_parameter_position + 0.01), get_variable_cexpression (cparam.name));
......@@ -473,7 +473,7 @@ public class Vala.CCodeDelegateModule : CCodeArrayModule {
}
}
} else if (param.variable_type is MethodType) {
var cparam = new CCodeFormalParameter (get_delegate_target_cname (get_variable_cname (param.name)), target_ctypename);
var cparam = new CCodeParameter (get_delegate_target_cname (get_variable_cname (param.name)), target_ctypename);
cparam_map.set (get_param_pos (param.cdelegate_target_parameter_position), cparam);
if (carg_map != null) {
carg_map.set (get_param_pos (param.cdelegate_target_parameter_position), get_variable_cexpression (cparam.name));
......
......@@ -499,8 +499,8 @@ public abstract class Vala.CCodeMemberAccessModule : CCodeControlFlowModule {
// don't unref variable
local.active = false;
}
} else if (expr.symbol_reference is FormalParameter) {
var p = (FormalParameter) expr.symbol_reference;
} else if (expr.symbol_reference is Parameter) {
var p = (Parameter) expr.symbol_reference;
if (p.name == "this") {
if (current_method != null && current_method.coroutine) {
// use closure
......
......@@ -33,7 +33,7 @@ public class Vala.CCodeMethodCallModule : CCodeAssignmentModule {
Method m = null;
Delegate deleg = null;
List<FormalParameter> params;
List<Parameter> params;
var ma = expr.call as MemberAccess;
......@@ -268,21 +268,21 @@ public class Vala.CCodeMethodCallModule : CCodeAssignmentModule {
var unary = arg as UnaryExpression;
if (unary != null && unary.operator == UnaryOperator.OUT) {
// out argument
var param = new FormalParameter ("param%d".printf (param_nr), unary.inner.value_type);
var param = new Parameter ("param%d".printf (param_nr), unary.inner.value_type);
param.direction = ParameterDirection.OUT;
m.add_parameter (param);
} else if (unary != null && unary.operator == UnaryOperator.REF) {
// ref argument
var param = new FormalParameter ("param%d".printf (param_nr), unary.inner.value_type);
var param = new Parameter ("param%d".printf (param_nr), unary.inner.value_type);
param.direction = ParameterDirection.REF;
m.add_parameter (param);
} else {
// in argument
m.add_parameter (new FormalParameter ("param%d".printf (param_nr), arg.value_type));
m.add_parameter (new Parameter ("param%d".printf (param_nr), arg.value_type));
}
param_nr++;
}
foreach (FormalParameter param in m.get_parameters ()) {
foreach (Parameter param in m.get_parameters ()) {
param.accept (this);
}
generate_dynamic_method_wrapper ((DynamicMethod) m);
......@@ -325,7 +325,7 @@ public class Vala.CCodeMethodCallModule : CCodeAssignmentModule {
int i = 1;
int arg_pos;
Iterator<FormalParameter> params_it = params.iterator ();
Iterator<Parameter> params_it = params.iterator ();
foreach (Expression arg in expr.get_argument_list ()) {
CCodeExpression cexpr = get_cvalue (arg);
......@@ -811,7 +811,7 @@ public class Vala.CCodeMethodCallModule : CCodeAssignmentModule {
var function = new CCodeFunction (to_string_func, "const char*");
function.modifiers = CCodeModifiers.STATIC;
function.add_parameter (new CCodeFormalParameter ("value", en.get_cname ()));
function.add_parameter (new CCodeParameter ("value", en.get_cname ()));
// definition
push_context (new EmitContext ());
......
......@@ -61,7 +61,7 @@ public abstract class Vala.CCodeMethodModule : CCodeStructModule {
return result;
}
public virtual void generate_method_result_declaration (Method m, CCodeFile decl_space, CCodeFunction cfunc, Map<int,CCodeFormalParameter> cparam_map, Map<int,CCodeExpression>? carg_map) {
public virtual void generate_method_result_declaration (Method m, CCodeFile decl_space, CCodeFunction cfunc, Map<int,CCodeParameter> cparam_map, Map<int,CCodeExpression>? carg_map) {
var creturn_type = m.return_type;
if (m is CreationMethod) {
var cl = m.parent_symbol as Class;
......@@ -80,7 +80,7 @@ public abstract class Vala.CCodeMethodModule : CCodeStructModule {
if (m.return_type.is_real_non_null_struct_type ()) {
// structs are returned via out parameter
var cparam = new CCodeFormalParameter ("result", m.return_type.get_cname () + "*");
var cparam = new CCodeParameter ("result", m.return_type.get_cname () + "*");
cparam_map.set (get_param_pos (-3), cparam);
if (carg_map != null) {
carg_map.set (get_param_pos (-3), get_result_cexpression ());
......@@ -90,7 +90,7 @@ public abstract class Vala.CCodeMethodModule : CCodeStructModule {
var array_type = (ArrayType) m.return_type;
for (int dim = 1; dim <= array_type.rank; dim++) {
var cparam = new CCodeFormalParameter (get_array_length_cname ("result", dim), "int*");
var cparam = new CCodeParameter (get_array_length_cname ("result", dim), "int*");
cparam_map.set (get_param_pos (m.carray_length_parameter_position + 0.01 * dim), cparam);
if (carg_map != null) {
carg_map.set (get_param_pos (m.carray_length_parameter_position + 0.01 * dim), get_variable_cexpression (cparam.name));
......@@ -101,13 +101,13 @@ public abstract class Vala.CCodeMethodModule : CCodeStructModule {
var deleg_type = (DelegateType) m.return_type;
var d = deleg_type.delegate_symbol;
if (d.has_target) {
var cparam = new CCodeFormalParameter (get_delegate_target_cname ("result"), "void**");
var cparam = new CCodeParameter (get_delegate_target_cname ("result"), "void**");
cparam_map.set (get_param_pos (m.cdelegate_target_parameter_position), cparam);
if (carg_map != null) {
carg_map.set (get_param_pos (m.cdelegate_target_parameter_position), get_variable_cexpression (cparam.name));
}
if (deleg_type.value_owned) {
cparam = new CCodeFormalParameter (get_delegate_target_destroy_notify_cname ("result"), "GDestroyNotify*");
cparam = new CCodeParameter (get_delegate_target_destroy_notify_cname ("result"), "GDestroyNotify*");
cparam_map.set (get_param_pos (m.cdelegate_target_parameter_position + 0.01), cparam);
if (carg_map != null) {
carg_map.set (get_param_pos (m.cdelegate_target_parameter_position + 0.01), get_variable_cexpression (cparam.name));
......@@ -121,7 +121,7 @@ public abstract class Vala.CCodeMethodModule : CCodeStructModule {
generate_type_declaration (error_type, decl_space);
}
var cparam = new CCodeFormalParameter ("error", "GError**");
var cparam = new CCodeParameter ("error", "GError**");
cparam_map.set (get_param_pos (-1), cparam);
if (carg_map != null) {
carg_map.set (get_param_pos (-1), new CCodeIdentifier (cparam.name));
......@@ -177,7 +177,7 @@ public abstract class Vala.CCodeMethodModule : CCodeStructModule {
function.modifiers |= CCodeModifiers.DEPRECATED;
}
var cparam_map = new HashMap<int,CCodeFormalParameter> (direct_hash, direct_equal);
var cparam_map = new HashMap<int,CCodeParameter> (direct_hash, direct_equal);
var carg_map = new HashMap<int,CCodeExpression> (direct_hash, direct_equal);
var cl = m.parent_symbol as Class;
......@@ -197,7 +197,7 @@ public abstract class Vala.CCodeMethodModule : CCodeStructModule {
function.modifiers |= CCodeModifiers.STATIC;
}
cparam_map = new HashMap<int,CCodeFormalParameter> (direct_hash, direct_equal);
cparam_map = new HashMap<int,CCodeParameter> (direct_hash, direct_equal);
generate_cparameters (m, decl_space, cparam_map, function);
decl_space.add_function_declaration (function);
......@@ -292,7 +292,7 @@ public abstract class Vala.CCodeMethodModule : CCodeStructModule {
}
foreach (FormalParameter param in m.get_parameters ()) {
foreach (Parameter param in m.get_parameters ()) {
param.accept (this);
}
......@@ -316,7 +316,7 @@ public abstract class Vala.CCodeMethodModule : CCodeStructModule {
function.modifiers |= CCodeModifiers.INLINE;
}
var cparam_map = new HashMap<int,CCodeFormalParameter> (direct_hash, direct_equal);
var cparam_map = new HashMap<int,CCodeParameter> (direct_hash, direct_equal);
generate_cparameters (m, cfile, cparam_map, function);
......@@ -342,7 +342,7 @@ public abstract class Vala.CCodeMethodModule : CCodeStructModule {
function = new CCodeFunction (m.get_real_cname () + "_co", "gboolean");
// data struct to hold parameters, local variables, and the return value
function.add_parameter (new CCodeFormalParameter ("data", Symbol.lower_case_to_camel_case (m.get_cname ()) + "Data*"));
function.add_parameter (new CCodeParameter ("data", Symbol.lower_case_to_camel_case (m.get_cname ()) + "Data*"));
function.modifiers |= CCodeModifiers.STATIC;
cfile.add_function_declaration (function);
......@@ -450,7 +450,7 @@ public abstract class Vala.CCodeMethodModule : CCodeStructModule {
}
}
foreach (FormalParameter param in m.get_parameters ()) {
foreach (Parameter param in m.get_parameters ()) {
if (param.ellipsis) {
break;
}
......@@ -684,7 +684,7 @@ public abstract class Vala.CCodeMethodModule : CCodeStructModule {
* emitter! */
m.signal_reference == null) {
cparam_map = new HashMap<int,CCodeFormalParameter> (direct_hash, direct_equal);
cparam_map = new HashMap<int,CCodeParameter> (direct_hash, direct_equal);
var carg_map = new HashMap<int,CCodeExpression> (direct_hash, direct_equal);
generate_vfunc (m, creturn_type, cparam_map, carg_map);
......@@ -694,8 +694,8 @@ public abstract class Vala.CCodeMethodModule : CCodeStructModule {
// m is possible entry point, add appropriate startup code
var cmain = new CCodeFunction ("main", "int");
cmain.line = function.line;
cmain.add_parameter (new CCodeFormalParameter ("argc", "int"));
cmain.add_parameter (new CCodeFormalParameter ("argv", "char **"));
cmain.add_parameter (new CCodeParameter ("argc", "int"));
cmain.add_parameter (new CCodeParameter ("argv", "char **"));
var main_block = new CCodeBlock ();
if (context.profile == Profile.GOBJECT) {
......@@ -741,8 +741,8 @@ public abstract class Vala.CCodeMethodModule : CCodeStructModule {
}
}
public virtual CCodeFormalParameter generate_parameter (FormalParameter param, CCodeFile decl_space, Map<int,CCodeFormalParameter> cparam_map, Map<int,CCodeExpression>? carg_map) {
CCodeFormalParameter cparam;
public virtual CCodeParameter generate_parameter (Parameter param, CCodeFile decl_space, Map<int,CCodeParameter> cparam_map, Map<int,CCodeExpression>? carg_map) {
CCodeParameter cparam;
if (!param.ellipsis) {
string ctypename = param.variable_type.get_cname ();
......@@ -766,9 +766,9 @@ public abstract class Vala.CCodeMethodModule : CCodeStructModule {
ctypename += "*";
}
cparam = new CCodeFormalParameter (get_variable_cname (param.name), ctypename);
cparam = new CCodeParameter (get_variable_cname (param.name), ctypename);
} else {
cparam = new CCodeFormalParameter.with_ellipsis ();
cparam = new CCodeParameter.with_ellipsis ();
}
cparam_map.set (get_param_pos (param.cparameter_position, param.ellipsis), cparam);
......@@ -779,16 +779,16 @@ public abstract class Vala.CCodeMethodModule : CCodeStructModule {
return cparam;
}
public override void generate_cparameters (Method m, CCodeFile decl_space, Map<int,CCodeFormalParameter> cparam_map, CCodeFunction func, CCodeFunctionDeclarator? vdeclarator = null, Map<int,CCodeExpression>? carg_map = null, CCodeFunctionCall? vcall = null, int direction = 3) {
public override void generate_cparameters (Method m, CCodeFile decl_space, Map<int,CCodeParameter> cparam_map, CCodeFunction func, CCodeFunctionDeclarator? vdeclarator = null, Map<int,CCodeExpression>? carg_map = null, CCodeFunctionCall? vcall = null, int direction = 3) {
if (m.closure) {
var closure_block = current_closure_block;
int block_id = get_block_id (closure_block);
var instance_param = new CCodeFormalParameter ("_data%d_".printf (block_id), "Block%dData*".printf (block_id));
var instance_param = new CCodeParameter ("_data%d_".printf (block_id), "Block%dData*".printf (block_id));
cparam_map.set (get_param_pos (m.cinstance_parameter_position), instance_param);
} else if (m.parent_symbol is Class && m is CreationMethod) {
var cl = (Class) m.parent_symbol;
if (!cl.is_compact && vcall == null) {
cparam_map.set (get_param_pos (m.cinstance_parameter_position), new CCodeFormalParameter ("object_type", "GType"));
cparam_map.set (get_param_pos (m.cinstance_parameter_position), new CCodeParameter ("object_type", "GType"));
}
} else if (m.binding == MemberBinding.INSTANCE || (m.parent_symbol is Struct && m is CreationMethod)) {
TypeSymbol parent_type = find_parent_type (m);
......@@ -807,18 +807,18 @@ public abstract class Vala.CCodeMethodModule : CCodeStructModule {
generate_type_declaration (this_type, decl_space);
CCodeFormalParameter instance_param = null;
CCodeParameter instance_param = null;
if (m.base_interface_method != null && !m.is_abstract && !m.is_virtual) {
var base_type = new ObjectType ((Interface) m.base_interface_method.parent_symbol);
instance_param = new CCodeFormalParameter ("base", base_type.get_cname ());
instance_param = new CCodeParameter ("base", base_type.get_cname ());
} else if (m.overrides) {
var base_type = new ObjectType ((Class) m.base_method.parent_symbol);
instance_param = new CCodeFormalParameter ("base", base_type.get_cname ());
instance_param = new CCodeParameter ("base", base_type.get_cname ());
} else {
if (m.parent_symbol is Struct && !((Struct) m.parent_symbol).is_simple_type ()) {
instance_param = new CCodeFormalParameter ("*self", this_type.get_cname ());
instance_param = new CCodeParameter ("*self", this_type.get_cname ());