vala r1388 - in trunk: . gobject vala
- From: juergbi svn gnome org
- To: svn-commits-list gnome org
- Subject: vala r1388 - in trunk: . gobject vala
- Date: Tue, 13 May 2008 09:53:39 +0100 (BST)
Author: juergbi
Date: Tue May 13 08:53:39 2008
New Revision: 1388
URL: http://svn.gnome.org/viewvc/vala?rev=1388&view=rev
Log:
2008-05-13 Juerg Billeter <j bitron ch>
* vala/valadelegate.vala:
* vala/valaformalparameter.vala:
* vala/valainterfacewriter.vala:
* vala/valamemorymanager.vala:
* vala/valamethod.vala:
* vala/valanullchecker.vala:
* vala/valasemanticanalyzer.vala:
* vala/valasourcefile.vala:
* gobject/valaccodeassignmentbinding.vala:
* gobject/valaccodeclassbinding.vala:
* gobject/valaccodedynamicmethodbinding.vala:
* gobject/valaccodedynamicsignalbinding.vala:
* gobject/valaccodeelementaccessbinding.vala:
* gobject/valaccodegenerator.vala:
* gobject/valaccodegeneratorsignal.vala:
* gobject/valaccodeinvocationexpressionbinding.vala:
* gobject/valaccodememberaccessbinding.vala:
* gobject/valaccodemethodbinding.vala:
* gobject/valaccodetypesymbolbinding.vala:
* gobject/valagidlwriter.vala:
Rename FormalParameter.type_reference to
FormalParameter.parameter_type
Modified:
trunk/ChangeLog
trunk/gobject/valaccodeassignmentbinding.vala
trunk/gobject/valaccodeclassbinding.vala
trunk/gobject/valaccodedynamicmethodbinding.vala
trunk/gobject/valaccodedynamicsignalbinding.vala
trunk/gobject/valaccodeelementaccessbinding.vala
trunk/gobject/valaccodegenerator.vala
trunk/gobject/valaccodegeneratorsignal.vala
trunk/gobject/valaccodeinvocationexpressionbinding.vala
trunk/gobject/valaccodememberaccessbinding.vala
trunk/gobject/valaccodemethodbinding.vala
trunk/gobject/valaccodetypesymbolbinding.vala
trunk/gobject/valagidlwriter.vala
trunk/vala/valadelegate.vala
trunk/vala/valaformalparameter.vala
trunk/vala/valainterfacewriter.vala
trunk/vala/valamemorymanager.vala
trunk/vala/valamethod.vala
trunk/vala/valanullchecker.vala
trunk/vala/valasemanticanalyzer.vala
trunk/vala/valasourcefile.vala
Modified: trunk/gobject/valaccodeassignmentbinding.vala
==============================================================================
--- trunk/gobject/valaccodeassignmentbinding.vala (original)
+++ trunk/gobject/valaccodeassignmentbinding.vala Tue May 13 08:53:39 2008
@@ -349,8 +349,8 @@
set_params_it.next ();
var set_param = set_params_it.get ();
- if (set_param.type_reference.type_parameter != null) {
- var index_type = SemanticAnalyzer.get_actual_type (expr.container.value_type, set_method, set_param.type_reference, assignment);
+ if (set_param.parameter_type.type_parameter != null) {
+ var index_type = SemanticAnalyzer.get_actual_type (expr.container.value_type, set_method, set_param.parameter_type, assignment);
cindex = codegen.convert_to_generic_pointer (cindex, index_type);
}
Modified: trunk/gobject/valaccodeclassbinding.vala
==============================================================================
--- trunk/gobject/valaccodeclassbinding.vala (original)
+++ trunk/gobject/valaccodeclassbinding.vala Tue May 13 08:53:39 2008
@@ -821,7 +821,7 @@
Report.error (param.source_reference, "unsupported parameter direction for D-Bus method");
}
- blob.append (param.type_reference.get_type_signature ());
+ blob.append (param.parameter_type.get_type_signature ());
blob.append ("\\0");
start++;
}
Modified: trunk/gobject/valaccodedynamicmethodbinding.vala
==============================================================================
--- trunk/gobject/valaccodedynamicmethodbinding.vala (original)
+++ trunk/gobject/valaccodedynamicmethodbinding.vala Tue May 13 08:53:39 2008
@@ -131,8 +131,8 @@
// error parameter
break;
}
- if (param.type_reference is ArrayType && ((ArrayType) param.type_reference).element_type.data_type != codegen.string_type.data_type) {
- var array_type = (ArrayType) param.type_reference;
+ if (param.parameter_type is ArrayType && ((ArrayType) param.parameter_type).element_type.data_type != codegen.string_type.data_type) {
+ var array_type = (ArrayType) param.parameter_type;
var cdecl = new CCodeDeclaration ("GArray*");
cdecl.add_declarator (new CCodeVariableDeclarator (param.name));
cb_fun.block.add_statement (cdecl);
@@ -141,19 +141,19 @@
creply_call.add_argument (new CCodeMemberAccess.pointer (new CCodeIdentifier (param.name), "data"));
creply_call.add_argument (new CCodeMemberAccess.pointer (new CCodeIdentifier (param.name), "len"));
} else {
- var cdecl = new CCodeDeclaration (param.type_reference.get_cname ());
+ var cdecl = new CCodeDeclaration (param.parameter_type.get_cname ());
cdecl.add_declarator (new CCodeVariableDeclarator (param.name));
cb_fun.block.add_statement (cdecl);
- if (param.type_reference is ArrayType && ((ArrayType) param.type_reference).element_type.data_type == codegen.string_type.data_type) {
+ if (param.parameter_type is ArrayType && ((ArrayType) param.parameter_type).element_type.data_type == codegen.string_type.data_type) {
// special case string array
cend_call.add_argument (new CCodeIdentifier ("G_TYPE_STRV"));
} else {
- cend_call.add_argument (new CCodeIdentifier (param.type_reference.data_type.get_type_id ()));
+ cend_call.add_argument (new CCodeIdentifier (param.parameter_type.data_type.get_type_id ()));
}
cend_call.add_argument (new CCodeUnaryExpression (CCodeUnaryOperator.ADDRESS_OF, new CCodeIdentifier (param.name)));
creply_call.add_argument (new CCodeIdentifier (param.name));
- if (param.type_reference is ArrayType && ((ArrayType) param.type_reference).element_type.data_type == codegen.string_type.data_type) {
+ if (param.parameter_type is ArrayType && ((ArrayType) param.parameter_type).element_type.data_type == codegen.string_type.data_type) {
var cstrvlen = new CCodeFunctionCall (new CCodeIdentifier ("g_strv_length"));
cstrvlen.add_argument (new CCodeIdentifier (param.name));
creply_call.add_argument (cstrvlen);
@@ -179,12 +179,12 @@
}
foreach (FormalParameter param in method.get_parameters ()) {
- if (param.type_reference is MethodType) {
+ if (param.parameter_type is MethodType) {
// callback parameter
break;
}
- ccall.add_argument (new CCodeIdentifier (param.type_reference.data_type.get_type_id ()));
+ ccall.add_argument (new CCodeIdentifier (param.parameter_type.data_type.get_type_id ()));
ccall.add_argument (new CCodeIdentifier (param.name));
}
Modified: trunk/gobject/valaccodedynamicsignalbinding.vala
==============================================================================
--- trunk/gobject/valaccodedynamicsignalbinding.vala (original)
+++ trunk/gobject/valaccodedynamicsignalbinding.vala Tue May 13 08:53:39 2008
@@ -126,8 +126,8 @@
first = false;
continue;
}
- if (param.type_reference is ArrayType && ((ArrayType) param.type_reference).element_type.data_type != codegen.string_type.data_type) {
- var array_type = (ArrayType) param.type_reference;
+ if (param.parameter_type is ArrayType && ((ArrayType) param.parameter_type).element_type.data_type != codegen.string_type.data_type) {
+ var array_type = (ArrayType) param.parameter_type;
if (array_type.element_type.data_type.get_type_id () == null) {
Report.error (param.source_reference, "unsupported parameter type for D-Bus signals");
return;
@@ -139,13 +139,13 @@
register_call.add_argument (carray_type);
add_call.add_argument (carray_type);
} else {
- if (param.type_reference.get_type_id () == null) {
+ if (param.parameter_type.get_type_id () == null) {
Report.error (param.source_reference, "unsupported parameter type for D-Bus signals");
return;
}
- register_call.add_argument (new CCodeIdentifier (param.type_reference.get_type_id ()));
- add_call.add_argument (new CCodeIdentifier (param.type_reference.get_type_id ()));
+ register_call.add_argument (new CCodeIdentifier (param.parameter_type.get_type_id ()));
+ add_call.add_argument (new CCodeIdentifier (param.parameter_type.get_type_id ()));
}
}
register_call.add_argument (new CCodeIdentifier ("G_TYPE_INVALID"));
Modified: trunk/gobject/valaccodeelementaccessbinding.vala
==============================================================================
--- trunk/gobject/valaccodeelementaccessbinding.vala (original)
+++ trunk/gobject/valaccodeelementaccessbinding.vala Tue May 13 08:53:39 2008
@@ -77,8 +77,8 @@
get_params_it.next ();
var get_param = get_params_it.get ();
- if (get_param.type_reference.type_parameter != null) {
- var index_type = SemanticAnalyzer.get_actual_type (expr.container.value_type, get_method, get_param.type_reference, expr);
+ if (get_param.parameter_type.type_parameter != null) {
+ var index_type = SemanticAnalyzer.get_actual_type (expr.container.value_type, get_method, get_param.parameter_type, expr);
cindex = codegen.convert_to_generic_pointer (cindex, index_type);
}
Modified: trunk/gobject/valaccodegenerator.vala
==============================================================================
--- trunk/gobject/valaccodegenerator.vala (original)
+++ trunk/gobject/valaccodegenerator.vala Tue May 13 08:53:39 2008
@@ -244,7 +244,7 @@
if (context.module_init_method != null) {
module_init_fragment = new CCodeFragment ();
foreach (FormalParameter parameter in context.module_init_method.get_parameters ()) {
- if (parameter.type_reference.data_type == type_module_type) {
+ if (parameter.parameter_type.data_type == type_module_type) {
in_plugin = true;
module_init_param_name = parameter.name;
break;
@@ -715,13 +715,13 @@
p.accept_children (this);
if (!p.ellipsis) {
- string ctypename = p.type_reference.get_cname ();
+ string ctypename = p.parameter_type.get_cname ();
string cname = p.name;
// pass non-simple structs always by reference
- if (p.type_reference.data_type is Struct) {
- var st = (Struct) p.type_reference.data_type;
- if (!st.is_simple_type () && p.direction == ParameterDirection.IN && !p.type_reference.nullable) {
+ if (p.parameter_type.data_type is Struct) {
+ var st = (Struct) p.parameter_type.data_type;
+ if (!st.is_simple_type () && p.direction == ParameterDirection.IN && !p.parameter_type.nullable) {
ctypename += "*";
}
}
@@ -1081,10 +1081,10 @@
if (b.parent_symbol is Method) {
var m = (Method) b.parent_symbol;
foreach (FormalParameter param in m.get_parameters ()) {
- if (param.type_reference.data_type != null && param.type_reference.data_type.is_reference_type () && param.type_reference.takes_ownership && param.direction == ParameterDirection.IN) {
+ if (param.parameter_type.data_type != null && param.parameter_type.data_type.is_reference_type () && param.parameter_type.takes_ownership && param.direction == ParameterDirection.IN) {
var ma = new MemberAccess.simple (param.name);
ma.symbol_reference = param;
- cblock.add_statement (new CCodeExpressionStatement (get_unref_expression (new CCodeIdentifier (get_variable_cname (param.name)), param.type_reference, ma)));
+ cblock.add_statement (new CCodeExpressionStatement (get_unref_expression (new CCodeIdentifier (get_variable_cname (param.name)), param.parameter_type, ma)));
}
}
}
@@ -2139,10 +2139,10 @@
private void append_param_free (Method m, CCodeFragment cfrag) {
foreach (FormalParameter param in m.get_parameters ()) {
- if (param.type_reference.data_type != null && param.type_reference.data_type.is_reference_type () && param.type_reference.takes_ownership && param.direction == ParameterDirection.IN) {
+ if (param.parameter_type.data_type != null && param.parameter_type.data_type.is_reference_type () && param.parameter_type.takes_ownership && param.direction == ParameterDirection.IN) {
var ma = new MemberAccess.simple (param.name);
ma.symbol_reference = param;
- cfrag.append (new CCodeExpressionStatement (get_unref_expression (new CCodeIdentifier (get_variable_cname (param.name)), param.type_reference, ma)));
+ cfrag.append (new CCodeExpressionStatement (get_unref_expression (new CCodeIdentifier (get_variable_cname (param.name)), param.parameter_type, ma)));
}
}
}
@@ -2184,11 +2184,11 @@
bool found = false;
foreach (FormalParameter param in m.get_parameters ()) {
- if (param.type_reference.data_type != null && param.type_reference.data_type.is_reference_type () && param.type_reference.takes_ownership && param.direction == ParameterDirection.IN) {
+ if (param.parameter_type.data_type != null && param.parameter_type.data_type.is_reference_type () && param.parameter_type.takes_ownership && param.direction == ParameterDirection.IN) {
found = true;
var ma = new MemberAccess.simple (param.name);
ma.symbol_reference = param;
- ccomma.append_expression (get_unref_expression (new CCodeIdentifier (get_variable_cname (param.name)), param.type_reference, ma));
+ ccomma.append_expression (get_unref_expression (new CCodeIdentifier (get_variable_cname (param.name)), param.parameter_type, ma));
}
}
@@ -2981,10 +2981,10 @@
param = params_it.get ();
ellipsis = param.ellipsis;
if (!param.ellipsis) {
- cexpr = get_implicit_cast_expression (cexpr, arg.value_type, param.type_reference);
+ cexpr = get_implicit_cast_expression (cexpr, arg.value_type, param.parameter_type);
// pass non-simple struct instances always by reference
- if (param.type_reference.data_type is Struct && !((Struct) param.type_reference.data_type).is_simple_type ()) {
+ if (param.parameter_type.data_type is Struct && !((Struct) param.parameter_type.data_type).is_simple_type ()) {
// we already use a reference for arguments of ref and out parameters
if (param.direction == ParameterDirection.IN) {
if (cexpr is CCodeIdentifier) {
@@ -3008,8 +3008,8 @@
creation_call.add_argument (cexpr);
- if (param != null && param.type_reference is DelegateType) {
- var deleg_type = (DelegateType) param.type_reference;
+ if (param != null && param.parameter_type is DelegateType) {
+ var deleg_type = (DelegateType) param.parameter_type;
var d = deleg_type.delegate_symbol;
if (d.has_target) {
creation_call.add_argument (get_delegate_target_cexpression (arg));
@@ -3448,8 +3448,8 @@
cparam_map.set (get_param_pos (param.cparameter_position), (CCodeFormalParameter) param.ccodenode);
// handle array parameters
- if (!param.no_array_length && param.type_reference is ArrayType) {
- var array_type = (ArrayType) param.type_reference;
+ if (!param.no_array_length && param.parameter_type is ArrayType) {
+ var array_type = (ArrayType) param.parameter_type;
var length_ctype = "int";
if (param.direction != ParameterDirection.IN) {
@@ -3510,8 +3510,8 @@
carg_map.set (get_param_pos (param.cparameter_position), arg);
// handle array arguments
- if (!param.no_array_length && param.type_reference is ArrayType) {
- var array_type = (ArrayType) param.type_reference;
+ if (!param.no_array_length && param.parameter_type is ArrayType) {
+ var array_type = (ArrayType) param.parameter_type;
for (int dim = 1; dim <= array_type.rank; dim++) {
CCodeExpression clength;
if (d_params.get (i).no_array_length) {
Modified: trunk/gobject/valaccodegeneratorsignal.vala
==============================================================================
--- trunk/gobject/valaccodegeneratorsignal.vala (original)
+++ trunk/gobject/valaccodegeneratorsignal.vala Tue May 13 08:53:39 2008
@@ -46,7 +46,7 @@
if (param.direction != ParameterDirection.IN) {
return ("POINTER");
} else {
- return get_marshaller_type_name (param.type_reference);
+ return get_marshaller_type_name (param.parameter_type);
}
}
@@ -106,7 +106,7 @@
if (p.direction != ParameterDirection.IN) {
return "gpointer";
} else {
- return get_value_type_name_from_type_reference (p.type_reference);
+ return get_value_type_name_from_type_reference (p.parameter_type);
}
}
@@ -233,12 +233,12 @@
i = 1;
foreach (FormalParameter p in params) {
string get_value_function;
- if (p.type_reference is PointerType || p.type_reference.type_parameter != null || p.direction != ParameterDirection.IN) {
+ if (p.parameter_type is PointerType || p.parameter_type.type_parameter != null || p.direction != ParameterDirection.IN) {
get_value_function = "g_value_get_pointer";
- } else if (p.type_reference is ErrorType) {
+ } else if (p.parameter_type is ErrorType) {
get_value_function = "g_value_get_pointer";
} else {
- get_value_function = p.type_reference.data_type.get_get_value_function ();
+ get_value_function = p.parameter_type.data_type.get_get_value_function ();
}
var inner_fc = new CCodeFunctionCall (new CCodeIdentifier (get_value_function));
inner_fc.add_argument (new CCodeBinaryExpression (CCodeBinaryOperator.PLUS, new CCodeIdentifier ("param_values"), new CCodeIdentifier (i.to_string ())));
Modified: trunk/gobject/valaccodeinvocationexpressionbinding.vala
==============================================================================
--- trunk/gobject/valaccodeinvocationexpressionbinding.vala (original)
+++ trunk/gobject/valaccodeinvocationexpressionbinding.vala Tue May 13 08:53:39 2008
@@ -176,30 +176,30 @@
// http://bugzilla.gnome.org/show_bug.cgi?id=519597
bool multiple_cargs = false;
- if (!param.no_array_length && param.type_reference is ArrayType) {
- var array_type = (ArrayType) param.type_reference;
+ if (!param.no_array_length && param.parameter_type is ArrayType) {
+ var array_type = (ArrayType) param.parameter_type;
for (int dim = 1; dim <= array_type.rank; dim++) {
carg_map.set (codegen.get_param_pos (param.carray_length_parameter_position + 0.01 * dim), codegen.get_array_length_cexpression (arg, dim));
}
multiple_cargs = true;
- } else if (param.type_reference is DelegateType) {
- var deleg_type = (DelegateType) param.type_reference;
+ } else if (param.parameter_type is DelegateType) {
+ var deleg_type = (DelegateType) param.parameter_type;
var d = deleg_type.delegate_symbol;
if (d.has_target) {
carg_map.set (codegen.get_param_pos (param.cdelegate_target_parameter_position), codegen.get_delegate_target_cexpression (arg));
multiple_cargs = true;
}
- } else if (param.type_reference is MethodType) {
+ } else if (param.parameter_type is MethodType) {
carg_map.set (codegen.get_param_pos (param.cdelegate_target_parameter_position), codegen.get_delegate_target_cexpression (arg));
multiple_cargs = true;
}
if (param.direction == ParameterDirection.IN) {
// don't cast arguments passed by reference
- cexpr = codegen.get_implicit_cast_expression (cexpr, arg.value_type, param.type_reference);
+ cexpr = codegen.get_implicit_cast_expression (cexpr, arg.value_type, param.parameter_type);
}
// pass non-simple struct instances always by reference
- if (!(arg.value_type is NullType) && param.type_reference.data_type is Struct && !((Struct) param.type_reference.data_type).is_simple_type ()) {
+ if (!(arg.value_type is NullType) && param.parameter_type.data_type is Struct && !((Struct) param.parameter_type.data_type).is_simple_type ()) {
// we already use a reference for arguments of ref and out parameters
if (param.direction == ParameterDirection.IN) {
if (cexpr is CCodeIdentifier) {
@@ -239,7 +239,7 @@
}
// unref old value for non-null non-weak out arguments
- if (param.direction == ParameterDirection.OUT && param.type_reference.takes_ownership && !(arg.value_type is NullType)) {
+ if (param.direction == ParameterDirection.OUT && param.parameter_type.takes_ownership && !(arg.value_type is NullType)) {
var unary = (UnaryExpression) arg;
// (ret_tmp = call (&tmp), free (var1), var1 = tmp, ret_tmp)
@@ -301,9 +301,9 @@
* parameter yet */
param.default_expression.accept (codegen);
- if (!param.no_array_length && param.type_reference != null &&
- param.type_reference is ArrayType) {
- var array_type = (ArrayType) param.type_reference;
+ if (!param.no_array_length && param.parameter_type != null &&
+ param.parameter_type is ArrayType) {
+ var array_type = (ArrayType) param.parameter_type;
for (int dim = 1; dim <= array_type.rank; dim++) {
carg_map.set (codegen.get_param_pos (param.carray_length_parameter_position + 0.01 * dim), codegen.get_array_length_cexpression (param.default_expression, dim));
}
Modified: trunk/gobject/valaccodememberaccessbinding.vala
==============================================================================
--- trunk/gobject/valaccodememberaccessbinding.vala (original)
+++ trunk/gobject/valaccodememberaccessbinding.vala Tue May 13 08:53:39 2008
@@ -190,7 +190,7 @@
if (p.name == "this") {
expr.ccodenode = pub_inst;
} else {
- var type_as_struct = p.type_reference.data_type as Struct;
+ var type_as_struct = p.parameter_type.data_type as Struct;
if (p.direction != ParameterDirection.IN
|| (type_as_struct != null && !type_as_struct.is_simple_type ())) {
expr.ccodenode = new CCodeIdentifier ("(*%s)".printf (p.name));
Modified: trunk/gobject/valaccodemethodbinding.vala
==============================================================================
--- trunk/gobject/valaccodemethodbinding.vala (original)
+++ trunk/gobject/valaccodemethodbinding.vala Tue May 13 08:53:39 2008
@@ -251,10 +251,10 @@
break;
}
- var t = param.type_reference.data_type;
+ var t = param.parameter_type.data_type;
if (t != null && t.is_reference_type ()) {
if (param.direction != ParameterDirection.OUT) {
- var type_check = create_method_type_check_statement (m, creturn_type, t, (codegen.context.non_null && !param.type_reference.nullable), param.name);
+ var type_check = create_method_type_check_statement (m, creturn_type, t, (codegen.context.non_null && !param.parameter_type.nullable), param.name);
if (type_check != null) {
type_check.line = codegen.function.line;
cinit.append (type_check);
@@ -403,8 +403,8 @@
var params = m.get_parameters ();
foreach (FormalParameter param in params) {
- if (!param.no_array_length && param.type_reference is ArrayType) {
- var array_type = (ArrayType) param.type_reference;
+ if (!param.no_array_length && param.parameter_type is ArrayType) {
+ var array_type = (ArrayType) param.parameter_type;
var length_ctype = "int";
if (param.direction != ParameterDirection.IN) {
@@ -421,8 +421,8 @@
cparam_map.set (codegen.get_param_pos (param.cparameter_position), (CCodeFormalParameter) param.ccodenode);
carg_map.set (codegen.get_param_pos (param.cparameter_position), new CCodeIdentifier (param.name));
- if (param.type_reference is DelegateType) {
- var deleg_type = (DelegateType) param.type_reference;
+ if (param.parameter_type is DelegateType) {
+ var deleg_type = (DelegateType) param.parameter_type;
var d = deleg_type.delegate_symbol;
if (d.has_target) {
var cparam = new CCodeFormalParameter (codegen.get_delegate_target_cname (param.name), "void*");
@@ -588,8 +588,8 @@
public void generate_cparameters (Method m, DataType creturn_type, Map<int,CCodeFormalParameter> cparam_map, CCodeFunction func, CCodeFunctionDeclarator? vdeclarator = null) {
foreach (FormalParameter param in m.get_parameters ()) {
- if (!param.no_array_length && param.type_reference is ArrayType) {
- var array_type = (ArrayType) param.type_reference;
+ if (!param.no_array_length && param.parameter_type is ArrayType) {
+ var array_type = (ArrayType) param.parameter_type;
var length_ctype = "int";
if (param.direction != ParameterDirection.IN) {
@@ -604,14 +604,14 @@
cparam_map.set (codegen.get_param_pos (param.cparameter_position), (CCodeFormalParameter) param.ccodenode);
- if (param.type_reference is DelegateType) {
- var deleg_type = (DelegateType) param.type_reference;
+ if (param.parameter_type is DelegateType) {
+ var deleg_type = (DelegateType) param.parameter_type;
var d = deleg_type.delegate_symbol;
if (d.has_target) {
var cparam = new CCodeFormalParameter (codegen.get_delegate_target_cname (param.name), "void*");
cparam_map.set (codegen.get_param_pos (param.cdelegate_target_parameter_position), cparam);
}
- } else if (param.type_reference is MethodType) {
+ } else if (param.parameter_type is MethodType) {
var cparam = new CCodeFormalParameter (codegen.get_delegate_target_cname (param.name), "void*");
cparam_map.set (codegen.get_param_pos (param.cdelegate_target_parameter_position), cparam);
}
@@ -746,12 +746,12 @@
return false;
}
- if (!(param.type_reference is ArrayType)) {
+ if (!(param.parameter_type is ArrayType)) {
// parameter must be an array
return false;
}
- var array_type = (ArrayType) param.type_reference;
+ var array_type = (ArrayType) param.parameter_type;
if (array_type.element_type.data_type != codegen.string_type.data_type) {
// parameter must be an array of strings
return false;
Modified: trunk/gobject/valaccodetypesymbolbinding.vala
==============================================================================
--- trunk/gobject/valaccodetypesymbolbinding.vala (original)
+++ trunk/gobject/valaccodetypesymbolbinding.vala Tue May 13 08:53:39 2008
@@ -193,12 +193,12 @@
}
csignew.add_argument (new CCodeConstant ("%d".printf (params_len)));
foreach (FormalParameter param in params) {
- if (param.type_reference is PointerType || param.type_reference.type_parameter != null || param.direction != ParameterDirection.IN) {
+ if (param.parameter_type is PointerType || param.parameter_type.type_parameter != null || param.direction != ParameterDirection.IN) {
csignew.add_argument (new CCodeConstant ("G_TYPE_POINTER"));
- } else if (param.type_reference is ErrorType) {
+ } else if (param.parameter_type is ErrorType) {
csignew.add_argument (new CCodeConstant ("G_TYPE_POINTER"));
} else {
- csignew.add_argument (new CCodeConstant (param.type_reference.data_type.get_type_id ()));
+ csignew.add_argument (new CCodeConstant (param.parameter_type.data_type.get_type_id ()));
}
}
Modified: trunk/gobject/valagidlwriter.vala
==============================================================================
--- trunk/gobject/valagidlwriter.vala (original)
+++ trunk/gobject/valagidlwriter.vala Tue May 13 08:53:39 2008
@@ -319,22 +319,22 @@
foreach (FormalParameter param in params) {
write_indent ();
- stream.printf ("<parameter name=\"%s\" type=\"%s\"", param.name, get_gidl_type_name (param.type_reference));
+ stream.printf ("<parameter name=\"%s\" type=\"%s\"", param.name, get_gidl_type_name (param.parameter_type));
if (param.direction == ParameterDirection.REF) {
stream.printf (" direction=\"inout\"");
// in/out paramter
- if (param.type_reference.takes_ownership) {
+ if (param.parameter_type.takes_ownership) {
stream.printf (" transfer=\"full\"");
}
} else if (param.direction == ParameterDirection.OUT) {
// out paramter
stream.printf (" direction=\"out\"");
- if (param.type_reference.takes_ownership) {
+ if (param.parameter_type.takes_ownership) {
stream.printf (" transfer=\"full\"");
}
} else {
// normal in paramter
- if (param.type_reference.transfers_ownership) {
+ if (param.parameter_type.transfers_ownership) {
stream.printf (" transfer=\"full\"");
}
}
Modified: trunk/vala/valadelegate.vala
==============================================================================
--- trunk/vala/valadelegate.vala (original)
+++ trunk/vala/valadelegate.vala Tue May 13 08:53:39 2008
@@ -177,7 +177,7 @@
// method is allowed to accept arguments of looser types (weaker precondition)
var method_param = method_params_it.get ();
- if (!param.type_reference.stricter (method_param.type_reference)) {
+ if (!param.parameter_type.stricter (method_param.parameter_type)) {
return false;
}
}
Modified: trunk/vala/valaformalparameter.vala
==============================================================================
--- trunk/vala/valaformalparameter.vala (original)
+++ trunk/vala/valaformalparameter.vala Tue May 13 08:53:39 2008
@@ -31,7 +31,7 @@
/**
* The parameter type.
*/
- public DataType type_reference {
+ public DataType parameter_type {
get { return _data_type; }
set {
_data_type = value;
@@ -92,10 +92,10 @@
* @param source reference to source code
* @return newly created formal parameter
*/
- public FormalParameter (string _name, DataType type, SourceReference? source = null) {
- name = _name;
- type_reference = type;
- source_reference = source;
+ public FormalParameter (string name, DataType parameter_type, SourceReference? source_reference = null) {
+ this.name = name;
+ this.parameter_type = parameter_type;
+ this.source_reference = source_reference;
}
/**
@@ -117,7 +117,7 @@
public override void accept_children (CodeVisitor visitor) {
if (!ellipsis) {
- type_reference.accept (visitor);
+ parameter_type.accept (visitor);
if (default_expression != null) {
default_expression.accept (visitor);
@@ -126,8 +126,8 @@
}
public override void replace_type (DataType old_type, DataType new_type) {
- if (type_reference == old_type) {
- type_reference = new_type;
+ if (parameter_type == old_type) {
+ parameter_type = new_type;
}
}
@@ -153,7 +153,7 @@
public FormalParameter copy () {
if (!ellipsis) {
- var result = new FormalParameter (name, type_reference, source_reference);
+ var result = new FormalParameter (name, parameter_type, source_reference);
return result;
} else {
return new FormalParameter.with_ellipsis ();
Modified: trunk/vala/valainterfacewriter.vala
==============================================================================
--- trunk/vala/valainterfacewriter.vala (original)
+++ trunk/vala/valainterfacewriter.vala Tue May 13 08:53:39 2008
@@ -538,14 +538,14 @@
} else if (param.direction == ParameterDirection.OUT) {
write_string ("out ");
}
- if (param.type_reference.data_type != null && param.type_reference.data_type.is_reference_type () && !param.type_reference.takes_ownership) {
+ if (param.parameter_type.data_type != null && param.parameter_type.data_type.is_reference_type () && !param.parameter_type.takes_ownership) {
write_string ("weak ");
}
}
- write_type (param.type_reference);
+ write_type (param.parameter_type);
- if (param.type_reference.transfers_ownership) {
+ if (param.parameter_type.transfers_ownership) {
write_string ("#");
}
@@ -625,7 +625,7 @@
if (m.no_array_length) {
bool array_found = (m.return_type is ArrayType);
foreach (FormalParameter param in m.get_parameters ()) {
- if (param.type_reference is ArrayType) {
+ if (param.parameter_type is ArrayType) {
array_found = true;
break;
}
Modified: trunk/vala/valamemorymanager.vala
==============================================================================
--- trunk/vala/valamemorymanager.vala (original)
+++ trunk/vala/valamemorymanager.vala Tue May 13 08:53:39 2008
@@ -245,12 +245,12 @@
if (params_it.next ()) {
var param = params_it.get ();
if (!param.ellipsis
- && param.type_reference.is_reference_type_or_type_parameter ()) {
- bool is_ref = param.type_reference.transfers_ownership;
- if (is_ref && param.type_reference.type_parameter != null) {
+ && param.parameter_type.is_reference_type_or_type_parameter ()) {
+ bool is_ref = param.parameter_type.transfers_ownership;
+ if (is_ref && param.parameter_type.type_parameter != null) {
if (expr.call is MemberAccess) {
var ma = (MemberAccess) expr.call;
- var param_type = SemanticAnalyzer.get_actual_type (ma.inner.value_type, ma.symbol_reference, param.type_reference, expr);
+ var param_type = SemanticAnalyzer.get_actual_type (ma.inner.value_type, ma.symbol_reference, param.parameter_type, expr);
if (param_type != null) {
is_ref = param_type.takes_ownership;
}
@@ -286,10 +286,10 @@
if (params_it.next ()) {
var param = params_it.get ();
if (!param.ellipsis
- && param.type_reference.is_reference_type_or_type_parameter ()) {
- bool is_ref = param.type_reference.transfers_ownership;
- if (is_ref && param.type_reference.type_parameter != null) {
- var param_type = SemanticAnalyzer.get_actual_type (expr.type_reference, msym, param.type_reference, expr);
+ && param.parameter_type.is_reference_type_or_type_parameter ()) {
+ bool is_ref = param.parameter_type.transfers_ownership;
+ if (is_ref && param.parameter_type.type_parameter != null) {
+ var param_type = SemanticAnalyzer.get_actual_type (expr.type_reference, msym, param.parameter_type, expr);
if (param_type != null) {
is_ref = param_type.takes_ownership;
}
Modified: trunk/vala/valamethod.vala
==============================================================================
--- trunk/vala/valamethod.vala (original)
+++ trunk/vala/valamethod.vala Tue May 13 08:53:39 2008
@@ -405,7 +405,7 @@
return false;
}
- if (!base_param.type_reference.equals (method_params_it.get ().type_reference)) {
+ if (!base_param.parameter_type.equals (method_params_it.get ().parameter_type)) {
invalid_match = "incompatible type of parameter %d".printf (param_index);
return false;
}
Modified: trunk/vala/valanullchecker.vala
==============================================================================
--- trunk/vala/valanullchecker.vala (original)
+++ trunk/vala/valanullchecker.vala Tue May 13 08:53:39 2008
@@ -102,7 +102,7 @@
p.accept_children (this);
if (p.default_expression != null) {
- check_compatible (p.default_expression, p.type_reference);
+ check_compatible (p.default_expression, p.parameter_type);
}
}
Modified: trunk/vala/valasemanticanalyzer.vala
==============================================================================
--- trunk/vala/valasemanticanalyzer.vala (original)
+++ trunk/vala/valasemanticanalyzer.vala Tue May 13 08:53:39 2008
@@ -549,22 +549,22 @@
if (context.non_null && p.default_expression != null) {
if (p.default_expression is NullLiteral
- && !p.type_reference.nullable
+ && !p.parameter_type.nullable
&& p.direction != ParameterDirection.OUT) {
- Report.warning (p.source_reference, "`null' incompatible with parameter type `%s`".printf (p.type_reference.to_string ()));
+ Report.warning (p.source_reference, "`null' incompatible with parameter type `%s`".printf (p.parameter_type.to_string ()));
}
}
if (!p.ellipsis) {
if (!p.is_internal_symbol ()) {
- current_source_file.add_type_dependency (p.type_reference, SourceFileDependencyType.HEADER_SHALLOW);
+ current_source_file.add_type_dependency (p.parameter_type, SourceFileDependencyType.HEADER_SHALLOW);
}
- current_source_file.add_type_dependency (p.type_reference, SourceFileDependencyType.SOURCE);
+ current_source_file.add_type_dependency (p.parameter_type, SourceFileDependencyType.SOURCE);
// check whether parameter type is at least as accessible as the method
- if (!is_type_accessible (p, p.type_reference)) {
+ if (!is_type_accessible (p, p.parameter_type)) {
p.error = true;
- Report.error (p.source_reference, "parameter type `%s` is less accessible than method `%s`".printf (p.type_reference.to_string (), p.parent_symbol.get_full_name ()));
+ Report.error (p.source_reference, "parameter type `%s` is less accessible than method `%s`".printf (p.parameter_type.to_string (), p.parent_symbol.get_full_name ()));
return;
}
}
@@ -1397,7 +1397,7 @@
return type;
} else if (sym is FormalParameter) {
var p = (FormalParameter) sym;
- var type = p.type_reference.copy ();
+ var type = p.parameter_type.copy ();
type.transfers_ownership = false;
return type;
} else if (sym is DataType) {
@@ -1785,7 +1785,7 @@
Expression arg = arg_it.get ();
/* store expected type for callback parameters */
- arg.expected_type = param.type_reference;
+ arg.expected_type = param.parameter_type;
}
}
@@ -1856,7 +1856,7 @@
}
/* header file necessary if we need to cast argument */
- current_source_file.add_type_dependency (param.type_reference, SourceFileDependencyType.SOURCE);
+ current_source_file.add_type_dependency (param.parameter_type, SourceFileDependencyType.SOURCE);
if (!arg_it.next ()) {
if (param.default_expression == null) {
@@ -1872,15 +1872,15 @@
return false;
} else if (arg.value_type == null) {
// disallow untyped arguments except for type inference of callbacks
- if (!(param.type_reference is DelegateType) || !(arg.symbol_reference is Method)) {
+ if (!(param.parameter_type is DelegateType) || !(arg.symbol_reference is Method)) {
expr.error = true;
Report.error (arg.source_reference, "Invalid type for argument %d".printf (i + 1));
return false;
}
- } else if (!arg.value_type.compatible (param.type_reference)
+ } else if (!arg.value_type.compatible (param.parameter_type)
&& !(arg is NullLiteral && param.direction == ParameterDirection.OUT)) {
expr.error = true;
- Report.error (arg.source_reference, "Argument %d: Cannot convert from `%s' to `%s'".printf (i + 1, arg.value_type.to_string (), param.type_reference.to_string ()));
+ Report.error (arg.source_reference, "Argument %d: Cannot convert from `%s' to `%s'".printf (i + 1, arg.value_type.to_string (), param.parameter_type.to_string ()));
return false;
} else {
// 0 => null, 1 => in, 2 => ref, 3 => out
@@ -1901,7 +1901,7 @@
expr.error = true;
Report.error (arg.source_reference, "Argument %d: Cannot pass null to reference parameter".printf (i + 1));
return false;
- } else if (context.non_null && param.direction != ParameterDirection.OUT && !param.type_reference.nullable) {
+ } else if (context.non_null && param.direction != ParameterDirection.OUT && !param.parameter_type.nullable) {
Report.warning (arg.source_reference, "Argument %d: Cannot pass null to non-null parameter type".printf (i + 1));
}
} else if (arg_type == 1) {
@@ -2159,9 +2159,9 @@
get_params_it.next ();
var get_param = get_params_it.get ();
- var index_type = get_param.type_reference;
+ var index_type = get_param.parameter_type;
if (index_type.type_parameter != null) {
- index_type = get_actual_type (expr.container.value_type, get_method, get_param.type_reference, expr);
+ index_type = get_actual_type (expr.container.value_type, get_method, get_param.parameter_type, expr);
}
if (!index.value_type.compatible (index_type)) {
@@ -2409,7 +2409,7 @@
Expression arg = arg_it.get ();
/* store expected type for callback parameters */
- arg.expected_type = param.type_reference;
+ arg.expected_type = param.parameter_type;
}
}
@@ -2931,7 +2931,7 @@
string lambda_param = lambda_param_it.get ();
- var param = new FormalParameter (lambda_param, cb_param.type_reference);
+ var param = new FormalParameter (lambda_param, cb_param.parameter_type);
l.method.add_parameter (param);
}
Modified: trunk/vala/valasourcefile.vala
==============================================================================
--- trunk/vala/valasourcefile.vala (original)
+++ trunk/vala/valasourcefile.vala Tue May 13 08:53:39 2008
@@ -245,7 +245,7 @@
s = sym;
} else if (sym is FormalParameter) {
var fp = (FormalParameter) sym;
- s = fp.type_reference.data_type;
+ s = fp.parameter_type.data_type;
if (s == null) {
/* generic type parameter */
return;
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]