2008-04-15 Jürg Billeter <j@bitron.ch>
+ * vala/valaarraytype.vala, vala/valaclasstype.vala,
+ vala/valadatatype.vala, vala/valaformalparameter.vala,
+ vala/valainterfacetype.vala, vala/valainterfacewriter.vala,
+ vala/valanulltype.vala, vala/valaparser.vala,
+ vala/valasemanticanalyzer.vala, vala/valasymbolresolver.vala,
+ vala/valatypeparametertype.vala, vala/valaunresolvedtype.vala,
+ vala/valavaluetype.vala, gobject/valaccodegenerator.vala,
+ gobject/valaccodegeneratorinterface.vala,
+ gobject/valaccodegeneratorinvocationexpression.vala,
+ gobject/valaccodegeneratormemberaccess.vala,
+ gobject/valaccodegeneratormethod.vala,
+ gobject/valaccodegeneratorsignal.vala,
+ gobject/valagidlwriter.vala, vapigen/valagidlparser.vala:
+
+ Remove is_ref and is_out properties from DataType class, add
+ direction property to FormalParameter class
+
+2008-04-15 Jürg Billeter <j@bitron.ch>
+
* vala/valaparser.vala: improve error handling
2008-04-14 Jürg Billeter <j@bitron.ch>
// 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.type_reference.is_ref && !p.type_reference.is_out && !p.type_reference.nullable) {
+ if (!st.is_simple_type () && p.direction == ParameterDirection.IN && !p.type_reference.nullable) {
ctypename += "*";
}
}
+ if (p.direction != ParameterDirection.IN) {
+ ctypename += "*";
+ }
+
p.ccodenode = new CCodeFormalParameter (cname, ctypename);
} else {
p.ccodenode = new CCodeFormalParameter.with_ellipsis ();
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.type_reference.is_ref && !param.type_reference.is_out) {
+ if (param.type_reference.data_type != null && param.type_reference.data_type.is_reference_type () && param.type_reference.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)));
public VariableDeclarator get_temp_variable_declarator (DataType type, bool takes_ownership = true, CodeNode? node_reference = null) {
var decl = new VariableDeclarator ("_tmp%d".printf (next_temp_var_id));
decl.type_reference = type.copy ();
- decl.type_reference.is_ref = false;
- decl.type_reference.is_out = false;
decl.type_reference.takes_ownership = takes_ownership;
if (node_reference != null) {
var collection_backup = stmt.collection_variable_declarator;
var collection_type = collection_backup.type_reference.copy ();
- collection_type.is_ref = false;
- collection_type.is_out = false;
var ccoldecl = new CCodeDeclaration (collection_type.get_cname ());
var ccolvardecl = new CCodeVariableDeclarator.with_initializer (collection_backup.name, (CCodeExpression) stmt.collection.ccodenode);
ccolvardecl.line = cblock.line;
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.type_reference.is_ref && !param.type_reference.is_out) {
+ if (param.type_reference.data_type != null && param.type_reference.data_type.is_reference_type () && param.type_reference.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)));
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.type_reference.is_ref && !param.type_reference.is_out) {
+ if (param.type_reference.data_type != null && param.type_reference.data_type.is_reference_type () && param.type_reference.takes_ownership && param.direction == ParameterDirection.IN) {
found = true;
var ma = new MemberAccess.simple (param.name);
ma.symbol_reference = param;
var param = (FormalParameter) array_expr.symbol_reference;
if (!param.no_array_length) {
CCodeExpression length_expr = new CCodeIdentifier (get_array_length_cname (param.name, dim));
- if (param.type_reference.is_out || param.type_reference.is_ref) {
+ if (param.direction != ParameterDirection.IN) {
// accessing argument of out/ref param
length_expr = new CCodeParenthesizedExpression (new CCodeUnaryExpression (CCodeUnaryOperator.POINTER_INDIRECTION, length_expr));
}
if (delegate_expr.symbol_reference is FormalParameter) {
var param = (FormalParameter) delegate_expr.symbol_reference;
CCodeExpression target_expr = new CCodeIdentifier (get_delegate_target_cname (param.name));
- if (param.type_reference.is_out || param.type_reference.is_ref) {
+ if (param.direction != ParameterDirection.IN) {
// accessing argument of out/ref param
target_expr = new CCodeParenthesizedExpression (new CCodeUnaryExpression (CCodeUnaryOperator.POINTER_INDIRECTION, target_expr));
}
// 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 ()) {
// we already use a reference for arguments of ref and out parameters
- if (!param.type_reference.is_ref && !param.type_reference.is_out) {
+ if (param.direction == ParameterDirection.IN) {
cexpr = new CCodeUnaryExpression (CCodeUnaryOperator.ADDRESS_OF, cexpr);
}
}
var array_type = (ArrayType) param.type_reference;
var length_ctype = "int";
- if (param.type_reference.is_out || param.type_reference.is_ref) {
+ if (param.direction != ParameterDirection.IN) {
length_ctype = "int*";
}
}
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.type_reference.is_ref || param.type_reference.is_out) {
+ if (param.type_reference is PointerType || param.type_reference.type_parameter != null || param.direction != ParameterDirection.IN) {
csignew.add_argument (new CCodeConstant ("G_TYPE_POINTER"));
} else if (param.type_reference is ErrorType) {
csignew.add_argument (new CCodeConstant ("G_TYPE_POINTER"));
// pass non-simple struct instances always by reference
if (!(arg.static_type is NullType) && param.type_reference.data_type is Struct && !((Struct) param.type_reference.data_type).is_simple_type ()) {
// we already use a reference for arguments of ref and out parameters
- if (!param.type_reference.is_ref && !param.type_reference.is_out) {
+ if (param.direction == ParameterDirection.IN) {
cexpr = new CCodeUnaryExpression (CCodeUnaryOperator.ADDRESS_OF, cexpr);
}
}
}
// unref old value for non-null non-weak out arguments
- if (param.type_reference.is_out && param.type_reference.takes_ownership && !(arg.static_type is NullType)) {
+ if (param.direction == ParameterDirection.OUT && param.type_reference.takes_ownership && !(arg.static_type is NullType)) {
var unary = (UnaryExpression) arg;
// (ret_tmp = call (&tmp), free (var1), var1 = tmp, ret_tmp)
expr.ccodenode = pub_inst;
} else {
var type_as_struct = p.type_reference.data_type as Struct;
- if (p.type_reference.is_out
- || p.type_reference.is_ref
+ if (p.direction != ParameterDirection.IN
|| (type_as_struct != null && !type_as_struct.is_simple_type ())) {
expr.ccodenode = new CCodeIdentifier ("(*%s)".printf (p.name));
} else {
var array_type = (ArrayType) param.type_reference;
var length_ctype = "int";
- if (param.type_reference.is_out || param.type_reference.is_ref) {
+ if (param.direction != ParameterDirection.IN) {
length_ctype = "int*";
}
var t = param.type_reference.data_type;
if (t != null && t.is_reference_type ()) {
- if (!param.type_reference.is_out) {
+ if (param.direction != ParameterDirection.OUT) {
var type_check = create_method_type_check_statement (m, creturn_type, t, (context.non_null && !param.type_reference.nullable), param.name);
if (type_check != null) {
type_check.line = function.line;
var array_type = (ArrayType) param.type_reference;
var length_ctype = "int";
- if (param.type_reference.is_out || param.type_reference.is_ref) {
+ if (param.direction != ParameterDirection.IN) {
length_ctype = "int*";
}
params_it.next ();
var param = params_it.get ();
- if (param.type_reference.is_out) {
+ if (param.direction == ParameterDirection.OUT) {
// parameter must not be an out parameter
return false;
}
public class Vala.CCodeGenerator {
private string get_marshaller_type_name (DataType t) {
- if (t is PointerType || t.type_parameter != null || t.is_ref || t.is_out) {
+ if (t is PointerType || t.type_parameter != null) {
return ("POINTER");
} else if (t is ErrorType) {
return ("POINTER");
}
}
+ private string get_marshaller_type_name_for_parameter (FormalParameter param) {
+ if (param.direction != ParameterDirection.IN) {
+ return ("POINTER");
+ } else {
+ return get_marshaller_type_name (param.type_reference);
+ }
+ }
+
public string get_signal_marshaller_function (Signal sig, string? prefix = null) {
var signature = get_signal_signature (sig);
string ret;
ret = ret + "_VOID";
} else {
foreach (FormalParameter p in params) {
- ret = "%s_%s".printf (ret, get_marshaller_type_name (p.type_reference));
+ ret = "%s_%s".printf (ret, get_marshaller_type_name_for_parameter (p));
}
}
}
private string? get_value_type_name_from_type_reference (DataType t) {
- if (t is PointerType || t.type_parameter != null || t.is_ref || t.is_out) {
+ if (t is PointerType || t.type_parameter != null) {
return "gpointer";
} else if (t is VoidType) {
return "void";
return null;
}
+ private string? get_value_type_name_from_parameter (FormalParameter p) {
+ if (p.direction != ParameterDirection.IN) {
+ return "gpointer";
+ } else {
+ return get_value_type_name_from_type_reference (p.type_reference);
+ }
+ }
+
private string get_signal_signature (Signal sig) {
string signature;
var params = sig.get_parameters ();
bool first = true;
foreach (FormalParameter p in params) {
if (first) {
- signature = signature + get_marshaller_type_name (p.type_reference);
+ signature = signature + get_marshaller_type_name_for_parameter (p);
first = false;
} else {
- signature = "%s,%s".printf (signature, get_marshaller_type_name (p.type_reference));
+ signature = "%s,%s".printf (signature, get_marshaller_type_name_for_parameter (p));
}
}
}
callback_decl.add_parameter (new CCodeFormalParameter ("data1", "gpointer"));
n_params = 1;
foreach (FormalParameter p in params) {
- callback_decl.add_parameter (new CCodeFormalParameter ("arg_%d".printf (n_params), get_value_type_name_from_type_reference (p.type_reference)));
+ callback_decl.add_parameter (new CCodeFormalParameter ("arg_%d".printf (n_params), get_value_type_name_from_parameter (p)));
n_params++;
}
callback_decl.add_parameter (new CCodeFormalParameter ("data2", "gpointer"));
i = 1;
foreach (FormalParameter p in params) {
string get_value_function;
- if (p.type_reference is PointerType || p.type_reference.type_parameter != null || p.type_reference.is_ref || p.type_reference.is_out) {
+ if (p.type_reference is PointerType || p.type_reference.type_parameter != null || p.direction != ParameterDirection.IN) {
get_value_function = "g_value_get_pointer";
} else if (p.type_reference is ErrorType) {
get_value_function = "g_value_get_pointer";
foreach (FormalParameter param in params) {
write_indent ();
stream.printf ("<parameter name=\"%s\" type=\"%s\"", param.name, get_gidl_type_name (param.type_reference));
- if (param.type_reference.is_ref) {
+ if (param.direction == ParameterDirection.REF) {
stream.printf (" direction=\"inout\"");
// in/out paramter
if (param.type_reference.takes_ownership) {
stream.printf (" transfer=\"full\"");
}
- } else if (param.type_reference.is_out) {
+ } else if (param.direction == ParameterDirection.OUT) {
// out paramter
stream.printf (" direction=\"out\"");
if (param.type_reference.takes_ownership) {
var result = new ArrayType (element_type, rank, source_reference);
result.transfers_ownership = transfers_ownership;
result.takes_ownership = takes_ownership;
- result.is_out = is_out;
result.nullable = nullable;
result.floating_reference = floating_reference;
- result.is_ref = is_ref;
foreach (DataType arg in get_type_arguments ()) {
result.add_type_argument (arg.copy ());
result.source_reference = source_reference;
result.transfers_ownership = transfers_ownership;
result.takes_ownership = takes_ownership;
- result.is_out = is_out;
result.nullable = nullable;
result.floating_reference = floating_reference;
- result.is_ref = is_ref;
foreach (DataType arg in get_type_arguments ()) {
result.add_type_argument (arg.copy ());
public bool takes_ownership { get; set; }
/**
- * Specifies that the expression is a reference used in out parameters.
- */
- public bool is_out { get; set; }
-
- /**
* Specifies that the expression may be null.
*/
public bool nullable { get; set; }
*/
public bool floating_reference { get; set; }
- /**
- * Specifies that the expression is a reference used in ref parameters.
- */
- public bool is_ref { get; set; }
-
private Gee.List<DataType> type_argument_list = new ArrayList<DataType> ();
/**
}
string ptr;
- if (type_parameter != null || (!data_type.is_reference_type () && !is_ref && !is_out)) {
+ if (type_parameter != null || !data_type.is_reference_type ()) {
ptr = "";
- } else if ((data_type.is_reference_type () && !is_ref && !is_out) || (!data_type.is_reference_type () && (is_ref || is_out))) {
- ptr = "*";
} else {
- ptr = "**";
+ ptr = "*";
}
if (data_type != null) {
return data_type.get_cname (const_type) + ptr;
if (type2.takes_ownership != takes_ownership) {
return false;
}
- if (type2.is_ref != is_ref) {
- return false;
- }
- if (type2.is_out != is_out) {
- return false;
- }
if (type2.nullable != nullable) {
return false;
}
if (type2.takes_ownership != takes_ownership) {
return false;
}
- if (type2.is_ref != is_ref) {
- return false;
- }
- if (type2.is_out != is_out) {
- return false;
- }
if (!type2.nullable && nullable) {
return false;
_data_type.parent_node = this;
}
}
-
+
+ public ParameterDirection direction { get; set; default = ParameterDirection.IN; }
+
/**
* Specifies whether the methods accepts an indefinite number of
* parameters.
}
}
}
+
+public enum Vala.ParameterDirection {
+ IN,
+ OUT,
+ REF
+}
+
result.source_reference = source_reference;
result.transfers_ownership = transfers_ownership;
result.takes_ownership = takes_ownership;
- result.is_out = is_out;
result.nullable = nullable;
result.floating_reference = floating_reference;
- result.is_ref = is_ref;
foreach (DataType arg in get_type_arguments ()) {
result.add_type_argument (arg.copy ());
write_string ("[CCode (%s)] ".printf (ccode_params.str));
}
- if (param.type_reference.is_ref || param.type_reference.is_out) {
- if (param.type_reference.is_ref) {
+ if (param.direction != ParameterDirection.IN) {
+ if (param.direction == ParameterDirection.REF) {
write_string ("ref ");
- } else if (param.type_reference.is_out) {
+ } 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) {
/* null can be cast to any reference or array type or pointer type */
if (target_type.type_parameter != null ||
target_type is PointerType ||
- target_type.is_out ||
target_type.nullable ||
target_type.data_type.get_attribute ("PointerType") != null) {
return true;
return type;
}
- bool is_ref = accept (TokenType.REF);
- bool is_out = !is_ref && accept (TokenType.OUT);
-
bool is_weak = accept (TokenType.WEAK);
var sym = parse_symbol_name ();
type.add_type_argument (type_arg);
}
}
- type.is_ref = is_ref;
- type.is_out = is_out;
type.is_weak = is_weak;
type.pointer_level = stars;
type.array_rank = array_rank;
Report.warning (get_last_src (), "deprecated syntax, use assignments in the method body");
construct_param = true;
}
+ var direction = ParameterDirection.IN;
+ if (accept (TokenType.OUT)) {
+ direction = ParameterDirection.OUT;
+ } else if (accept (TokenType.REF)) {
+ direction = ParameterDirection.REF;
+ }
+
var type = parse_type ();
var ut = type as UnresolvedType;
if (ut != null) {
if (!ut.is_weak) {
ut.takes_ownership = true;
}
- if (!ut.is_ref && !ut.is_out && !ut.transfers_ownership) {
+ if (direction == ParameterDirection.IN && !ut.transfers_ownership) {
// take_ownership for in parameters that don't transfer ownership is not supported
ut.takes_ownership = false;
}
string id = parse_identifier ();
var param = context.create_formal_parameter (id, type, get_src (begin));
set_attributes (param, attrs);
+ param.direction = direction;
param.construct_parameter = construct_param;
if (accept (TokenType.ASSIGN)) {
param.default_expression = parse_expression ();
if (p.default_expression != null) {
if (p.default_expression is NullLiteral
&& !p.type_reference.nullable
- && !p.type_reference.is_out) {
+ && p.direction != ParameterDirection.OUT) {
p.error = true;
Report.error (p.source_reference, "`null' incompatible with parameter type `%s`".printf (p.type_reference.to_string ()));
return;
Report.error (arg.source_reference, "Invalid type for argument %d".printf (i + 1));
return false;
}
- } else if (!arg.static_type.compatible (param.type_reference)) {
+ } else if (!arg.static_type.compatible (param.type_reference)
+ && !(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.static_type.to_string (), param.type_reference.to_string ()));
return false;
}
if (arg_type == 0) {
- if (param.type_reference.is_ref) {
+ if (param.direction == ParameterDirection.REF) {
expr.error = true;
Report.error (arg.source_reference, "Argument %d: Cannot pass null to reference parameter".printf (i + 1));
return false;
- } else if (!param.type_reference.is_out && !param.type_reference.nullable) {
+ } else if (param.direction != ParameterDirection.OUT && !param.type_reference.nullable) {
Report.warning (arg.source_reference, "Argument %d: Cannot pass null to non-null parameter type".printf (i + 1));
}
} else if (arg_type == 1) {
- if (param.type_reference.is_ref || param.type_reference.is_out) {
+ if (param.direction != ParameterDirection.IN) {
expr.error = true;
Report.error (arg.source_reference, "Argument %d: Cannot pass value to reference or output parameter".printf (i + 1));
return false;
}
} else if (arg_type == 2) {
- if (!param.type_reference.is_ref) {
+ if (param.direction != ParameterDirection.REF) {
expr.error = true;
Report.error (arg.source_reference, "Argument %d: Cannot pass ref argument to non-reference parameter".printf (i + 1));
return false;
}
} else if (arg_type == 3) {
- if (!param.type_reference.is_out) {
+ if (param.direction != ParameterDirection.OUT) {
expr.error = true;
Report.error (arg.source_reference, "Argument %d: Cannot pass out argument to non-output parameter".printf (i + 1));
return false;
type.source_reference = unresolved_type.source_reference;
type.takes_ownership = unresolved_type.takes_ownership;
type.transfers_ownership = unresolved_type.transfers_ownership;
- type.is_ref = unresolved_type.is_ref;
- type.is_out = unresolved_type.is_out;
type.nullable = unresolved_type.nullable;
foreach (DataType type_arg in unresolved_type.get_type_arguments ()) {
type.add_type_argument (type_arg);
var base_type = type;
base_type.takes_ownership = false;
base_type.transfers_ownership = false;
- base_type.is_ref = false;
- base_type.is_out = false;
base_type.nullable = false;
type = new PointerType (base_type);
if (unresolved_type.array_rank > 0) {
var element_type = type;
element_type.transfers_ownership = false;
- element_type.is_ref = false;
- element_type.is_out = false;
element_type.nullable = false;
type = new ArrayType (element_type, unresolved_type.array_rank, unresolved_type.source_reference);
type.takes_ownership = unresolved_type.takes_ownership;
type.transfers_ownership = unresolved_type.transfers_ownership;
- type.is_ref = unresolved_type.is_ref;
- type.is_out = unresolved_type.is_out;
type.nullable = unresolved_type.nullable;
}
result.source_reference = source_reference;
result.transfers_ownership = transfers_ownership;
result.takes_ownership = takes_ownership;
- result.is_out = is_out;
result.nullable = nullable;
result.floating_reference = floating_reference;
- result.is_ref = is_ref;
return result;
}
result.source_reference = source_reference;
result.transfers_ownership = transfers_ownership;
result.takes_ownership = takes_ownership;
- result.is_out = is_out;
result.nullable = nullable;
result.unresolved_symbol = unresolved_symbol.copy ();
result.array_rank = array_rank;
result.pointer_level = pointer_level;
- result.is_ref = is_ref;
result.is_weak = is_weak;
foreach (DataType arg in get_type_arguments ()) {
result.source_reference = source_reference;
result.transfers_ownership = transfers_ownership;
result.takes_ownership = takes_ownership;
- result.is_out = is_out;
result.nullable = nullable;
result.floating_reference = floating_reference;
- result.is_ref = is_ref;
foreach (DataType arg in get_type_arguments ()) {
result.add_type_argument (arg.copy ());
public override string? get_cname (bool var_type, bool const_type) {
string ptr = "";
- if (is_ref || is_out) {
- ptr += "*";
- }
if (nullable) {
- ptr += "*";
+ ptr = "*";
}
return type_symbol.get_cname (const_type) + ptr;
}
private Delegate? parse_delegate (IdlNodeFunction f_node) {
weak IdlNode node = (IdlNode) f_node;
-
+
var cb = new Delegate (node.name, parse_param (f_node.result), current_source_reference);
cb.access = SymbolAccessibility.PUBLIC;
param_name = "str";
}
- var p = new FormalParameter (param_name, parse_param (param));
+ ParameterDirection direction;
+ var p = new FormalParameter (param_name, parse_param (param, out direction));
+ p.direction = direction;
cb.add_parameter (p);
}
current_data_type = null;
}
- private UnresolvedType? parse_type (IdlNodeType type_node) {
+ private UnresolvedType? parse_type (IdlNodeType type_node, out ParameterDirection direction = null) {
+ ParameterDirection dir = ParameterDirection.IN;
+
var type = new UnresolvedType ();
if (type_node.tag == TypeTag.VOID) {
if (type_node.is_pointer) {
(n == "gchar" || n == "char")) {
type.unresolved_symbol = new UnresolvedSymbol (null, "string");
if (type_node.unparsed.has_suffix ("**")) {
- type.is_out = true;
+ dir = ParameterDirection.OUT;
}
} else if (n == "gunichar") {
type.unresolved_symbol = new UnresolvedSymbol (null, "unichar");
parse_type_string (type, n);
if (is_simple_type (n)) {
if (type_node.is_pointer) {
- type.is_out = true;
+ dir = ParameterDirection.OUT;
}
} else if (type_node.unparsed.has_suffix ("**")) {
- type.is_out = true;
+ dir = ParameterDirection.OUT;
}
}
} else {
stdout.printf ("%d\n", type_node.tag);
}
+ if (&direction != null) {
+ direction = dir;
+ }
return type;
}
}
}
- private UnresolvedType parse_param (IdlNodeParam param) {
- var type = parse_type (param.type);
+ private UnresolvedType parse_param (IdlNodeParam param, out ParameterDirection direction = null) {
+ var type = parse_type (param.type, out direction);
// disable for now as null_ok not yet correctly set
// type.non_null = !param.null_ok;
} else if (nv[0] == "is_array") {
if (eval (nv[1]) == "1") {
return_type.array_rank = 1;
- return_type.is_out = false;
}
} else if (nv[0] == "throws") {
if (eval (nv[1]) == "0") {
// avoid conflict with string type
param_name = "str";
}
- var param_type = parse_param (param);
+ ParameterDirection direction;
+ var param_type = parse_param (param, out direction);
var p = new FormalParameter (param_name, param_type);
+ p.direction = direction;
bool hide_param = false;
bool show_param = false;
if (nv[0] == "is_array") {
if (eval (nv[1]) == "1") {
param_type.array_rank = 1;
- param_type.is_out = false;
+ p.direction = ParameterDirection.IN;
}
} else if (nv[0] == "is_out") {
if (eval (nv[1]) == "1") {
- param_type.is_out = true;
+ p.direction = ParameterDirection.OUT;
}
} else if (nv[0] == "is_ref") {
if (eval (nv[1]) == "1") {
- param_type.is_ref = true;
+ p.direction = ParameterDirection.REF;
}
} else if (nv[0] == "nullable") {
if (eval (nv[1]) == "1") {
if (last_param != null && p.name == "n_" + last_param.name) {
// last_param is array, p is array length
last_param_type.array_rank = 1;
- last_param_type.is_out = false;
+ last_param.direction = ParameterDirection.IN;
// hide array length param
hide_param = true;
weak IdlNode param_node = (IdlNode) param;
- var param_type = parse_param (param);
+ ParameterDirection direction;
+ var param_type = parse_param (param, out direction);
var p = new FormalParameter (param_node.name, param_type);
+ p.direction = direction;
sig.add_parameter (p);
var attributes = get_attributes ("%s::%s.%s".printf (current_data_type.get_cname (), sig.name, param_node.name));
if (nv[0] == "is_array") {
if (eval (nv[1]) == "1") {
param_type.array_rank = 1;
- param_type.is_out = false;
+ p.direction = ParameterDirection.IN;
}
} else if (nv[0] == "is_out") {
if (eval (nv[1]) == "1") {
- param_type.is_out = true;
+ p.direction = ParameterDirection.OUT;
}
} else if (nv[0] == "is_ref") {
if (eval (nv[1]) == "1") {
- param_type.is_ref = true;
+ p.direction = ParameterDirection.REF;
}
} else if (nv[0] == "nullable") {
if (eval (nv[1]) == "1") {