[vala/wip/attributes: 90/100] Add get_ccode_array_null_terminated and drop related C bits from code nodes
- From: Luca Bruno <lucabru src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [vala/wip/attributes: 90/100] Add get_ccode_array_null_terminated and drop related C bits from code nodes
- Date: Sat, 2 Jul 2011 12:32:51 +0000 (UTC)
commit f264884a30d6cc4a646a6bd207be7cd555ba93a0
Author: Luca Bruno <lucabru src gnome org>
Date: Sat Jul 2 09:47:36 2011 +0200
Add get_ccode_array_null_terminated and drop related C bits from code nodes
codegen/valaccodeassignmentmodule.vala | 2 +-
codegen/valaccodebasemodule.vala | 8 ++++-
codegen/valaccodedelegatemodule.vala | 2 +-
codegen/valaccodememberaccessmodule.vala | 8 ++--
codegen/valaccodemethodcallmodule.vala | 4 +-
codegen/valadovamethodcallmodule.vala | 4 +-
codegen/valagirwriter.vala | 11 +++---
vala/valacreationmethod.vala | 3 --
vala/valadelegate.vala | 51 +--------------------------
vala/valagirparser.vala | 42 +++++++++------------
vala/valalambdaexpression.vala | 2 -
vala/valamethod.vala | 42 ----------------------
vala/valaparameter.vala | 57 +-----------------------------
vala/valasignal.vala | 6 ---
vapigen/valagidlparser.vala | 4 +-
15 files changed, 44 insertions(+), 202 deletions(-)
---
diff --git a/codegen/valaccodeassignmentmodule.vala b/codegen/valaccodeassignmentmodule.vala
index 53826e7..d4b7628 100644
--- a/codegen/valaccodeassignmentmodule.vala
+++ b/codegen/valaccodeassignmentmodule.vala
@@ -67,7 +67,7 @@ public class Vala.CCodeAssignmentModule : CCodeMemberAccessModule {
ccode.add_expression (destroy_value (value));
}
- if (array && !get_ccode_no_array_length (variable) && !variable.array_null_terminated) {
+ if (array && !get_ccode_no_array_length (variable) && !get_ccode_array_null_terminated (variable)) {
var array_type = (ArrayType) assignment.left.value_type;
for (int dim = 1; dim <= array_type.rank; dim++) {
var lhs_array_len = get_array_length_cexpression (assignment.left, dim);
diff --git a/codegen/valaccodebasemodule.vala b/codegen/valaccodebasemodule.vala
index 7864374..82b55ba 100644
--- a/codegen/valaccodebasemodule.vala
+++ b/codegen/valaccodebasemodule.vala
@@ -2138,7 +2138,7 @@ public abstract class Vala.CCodeBaseModule : CodeGenerator {
clist.append (cexpr);
var array_type = field.variable_type as ArrayType;
- if (array_type != null && !get_ccode_no_array_length (field) && !field.array_null_terminated) {
+ if (array_type != null && !get_ccode_no_array_length (field) && !get_ccode_array_null_terminated (field)) {
for (int dim = 1; dim <= array_type.rank; dim++) {
clist.append (get_array_length_cvalue (expr.target_value, dim));
}
@@ -5741,6 +5741,10 @@ public abstract class Vala.CCodeBaseModule : CodeGenerator {
return get_ccode_attribute(node).array_length_type;
}
+ public static bool get_ccode_array_null_terminated (CodeNode node) {
+ return get_ccode_attribute(node).array_null_terminated;
+ }
+
public static double get_ccode_array_length_pos (CodeNode node) {
var a = node.get_attribute ("CCode");
if (a != null && a.has_argument ("array_length_pos")) {
@@ -6468,6 +6472,7 @@ public class Vala.CCodeAttribute : AttributeCache {
public bool no_array_length { get; private set; }
public string? array_length_type { get; private set; }
+ public bool array_null_terminated { get; private set; }
private string _name;
private string _const_name;
@@ -6541,6 +6546,7 @@ public class Vala.CCodeAttribute : AttributeCache {
no_array_length = !attr.get_bool ("array_length");
}
array_length_type = attr.get_string ("array_length_type");
+ array_null_terminated = attr.get_bool ("array_null_terminated");
if (attr.has_argument ("pos")) {
_pos = attr.get_double ("pos");
}
diff --git a/codegen/valaccodedelegatemodule.vala b/codegen/valaccodedelegatemodule.vala
index 91d5f00..7567c02 100644
--- a/codegen/valaccodedelegatemodule.vala
+++ b/codegen/valaccodedelegatemodule.vala
@@ -226,7 +226,7 @@ public class Vala.CCodeDelegateModule : CCodeArrayModule {
&& ((ArrayType) param.variable_type).element_type.data_type == string_type.data_type) {
// use null-terminated string arrays for dynamic signals for compatibility reasons
param.set_attribute_bool ("CCode", "array_length", false);
- param.array_null_terminated = true;
+ param.set_attribute_bool ("CCode", "array_null_terminated", true);
}
generate_parameter (param, cfile, cparam_map, null);
diff --git a/codegen/valaccodememberaccessmodule.vala b/codegen/valaccodememberaccessmodule.vala
index fa4a2e3..5a728ee 100644
--- a/codegen/valaccodememberaccessmodule.vala
+++ b/codegen/valaccodememberaccessmodule.vala
@@ -398,7 +398,7 @@ public abstract class Vala.CCodeMemberAccessModule : CCodeControlFlowModule {
/* Returns access values to the given parameter */
public override TargetValue get_parameter_cvalue (Parameter param) {
var result = new GLibValue (param.variable_type.copy ());
- result.array_null_terminated = param.array_null_terminated;
+ result.array_null_terminated = get_ccode_array_null_terminated (param);
if (param.has_array_length_cexpr) {
result.array_length_cexpr = new CCodeConstant (param.get_array_length_cexpr ());
}
@@ -492,7 +492,7 @@ public abstract class Vala.CCodeMemberAccessModule : CCodeControlFlowModule {
}
}
if (!param.captured && array_type != null) {
- if (!get_ccode_no_array_length (param) && !param.array_null_terminated) {
+ if (!get_ccode_no_array_length (param) && !get_ccode_array_null_terminated (param)) {
for (int dim = 1; dim <= array_type.rank; dim++) {
CCodeExpression length_expr = get_variable_cexpression (get_parameter_array_length_cname (param, dim));
if (param.direction == ParameterDirection.OUT) {
@@ -518,7 +518,7 @@ public abstract class Vala.CCodeMemberAccessModule : CCodeControlFlowModule {
}
var result = new GLibValue (value_type);
- result.array_null_terminated = field.array_null_terminated;
+ result.array_null_terminated = get_ccode_array_null_terminated (field);
if (field.has_array_length_cexpr) {
result.array_length_cexpr = new CCodeConstant (field.get_array_length_cexpr ());
}
@@ -666,7 +666,7 @@ public abstract class Vala.CCodeMemberAccessModule : CCodeControlFlowModule {
if (array_type.fixed_length) {
result.array_length_cvalues = null;
result.append_array_length_cvalue (new CCodeConstant (array_type.length.to_string ()));
- } else if (variable.array_null_terminated) {
+ } else if (get_ccode_array_null_terminated (variable)) {
requires_array_length = true;
var len_call = new CCodeFunctionCall (new CCodeIdentifier ("_vala_array_length"));
len_call.add_argument (result.cvalue);
diff --git a/codegen/valaccodemethodcallmodule.vala b/codegen/valaccodemethodcallmodule.vala
index 9d1de0f..9bcb719 100644
--- a/codegen/valaccodemethodcallmodule.vala
+++ b/codegen/valaccodemethodcallmodule.vala
@@ -464,7 +464,7 @@ public class Vala.CCodeMethodCallModule : CCodeAssignmentModule {
if (m != null && m.return_type is ArrayType && async_call != ccall) {
var array_type = (ArrayType) m.return_type;
for (int dim = 1; dim <= array_type.rank; dim++) {
- if (m.array_null_terminated) {
+ if (get_ccode_array_null_terminated (m)) {
// handle calls to methods returning null-terminated arrays
var temp_var = get_temp_variable (itype.get_return_type (), true, null, false);
var temp_ref = get_variable_cexpression (temp_var.name);
@@ -532,7 +532,7 @@ public class Vala.CCodeMethodCallModule : CCodeAssignmentModule {
if (deleg != null && deleg.return_type is ArrayType) {
var array_type = (ArrayType) deleg.return_type;
for (int dim = 1; dim <= array_type.rank; dim++) {
- if (deleg.array_null_terminated) {
+ if (get_ccode_array_null_terminated (deleg)) {
// handle calls to methods returning null-terminated arrays
var temp_var = get_temp_variable (itype.get_return_type (), true, null, false);
var temp_ref = get_variable_cexpression (temp_var.name);
diff --git a/codegen/valadovamethodcallmodule.vala b/codegen/valadovamethodcallmodule.vala
index 6d25397..a829d61 100644
--- a/codegen/valadovamethodcallmodule.vala
+++ b/codegen/valadovamethodcallmodule.vala
@@ -178,8 +178,8 @@ public class Vala.DovaMethodCallModule : DovaAssignmentModule {
ccall_expr = ccomma;
}
- if (param.ctype != null) {
- cexpr = new CCodeCastExpression (cexpr, param.ctype);
+ if (CCodeBaseModule.get_ccode_type (param) != null) {
+ cexpr = new CCodeCastExpression (cexpr, CCodeBaseModule.get_ccode_type (param));
}
}
}
diff --git a/codegen/valagirwriter.vala b/codegen/valagirwriter.vala
index 74be656..4e0cd7f 100644
--- a/codegen/valagirwriter.vala
+++ b/codegen/valagirwriter.vala
@@ -170,7 +170,7 @@ public class Vala.GIRWriter : CodeVisitor {
write_indent ();
buffer.append_printf ("<namespace name=\"%s\" version=\"%s\"", gir_namespace, gir_version);
- string? cprefix = ns.get_cprefix ();
+ string? cprefix = CCodeBaseModule.get_ccode_prefix (ns);
if (cprefix != null) {
buffer.append_printf (" c:prefix=\"%s\"", cprefix);
}
@@ -1138,22 +1138,21 @@ public class Vala.GIRWriter : CodeVisitor {
}
}
- private string? get_full_gir_name (TypeSymbol sym) {
+ private string? get_full_gir_name (Symbol sym) {
var gir_name = sym.get_attribute_string ("GIR", "name") ?? sym.name;
if (sym.parent_symbol == null) {
return gir_name;
}
if (sym.name == null) {
- return get_full_gir_name (parent_symbol);
+ return get_full_gir_name (sym.parent_symbol);
}
- string parent_gir_name = get_full_gir_name (parent_symbol);
+ string parent_gir_name = get_full_gir_name (sym.parent_symbol);
if (parent_gir_name == null) {
return gir_name;
}
- string parent_gir_name = parent_symbol.get_full_gir_name ();
string self_gir_name = gir_name.has_prefix (".") ? gir_name.substring (1) : gir_name;
if ("." in parent_gir_name) {
return "%s%s".printf (parent_gir_name, self_gir_name);
@@ -1181,7 +1180,7 @@ public class Vala.GIRWriter : CodeVisitor {
}
}
- return type_symbol.get_full_gir_name();
+ return get_full_gir_name (type_symbol);
}
private string? literal_expression_to_value_string (Expression literal) {
diff --git a/vala/valacreationmethod.vala b/vala/valacreationmethod.vala
index 88194c4..3cf045f 100644
--- a/vala/valacreationmethod.vala
+++ b/vala/valacreationmethod.vala
@@ -49,9 +49,6 @@ public class Vala.CreationMethod : Method {
public CreationMethod (string? class_name, string? name, SourceReference? source_reference = null, Comment? comment = null) {
base (name, new VoidType (), source_reference, comment);
this.class_name = class_name;
-
- carray_length_parameter_position = -3;
- cdelegate_target_parameter_position = -3;
}
public override void accept (CodeVisitor visitor) {
diff --git a/vala/valadelegate.vala b/vala/valadelegate.vala
index b5022db..216d516 100644
--- a/vala/valadelegate.vala
+++ b/vala/valadelegate.vala
@@ -62,28 +62,6 @@ public class Vala.Delegate : TypeSymbol {
public DataType? sender_type { get; set; }
- /**
- * Specifies the position of the array length out parameter in the C
- * function.
- */
- public double carray_length_parameter_position { get; set; }
-
- /**
- * Specifies the position of the delegate target out parameter in the C
- * function.
- */
- public double cdelegate_target_parameter_position { get; set; }
-
- /**
- * Specifies whether the array is null terminated.
- */
- public bool array_null_terminated { get; set; }
-
- /**
- * Specifies a custom type for the array length parameter.
- */
- public string? array_length_type { get; set; default = null; }
-
private List<TypeParameter> type_parameters = new ArrayList<TypeParameter> ();
private List<Parameter> parameters = new ArrayList<Parameter> ();
@@ -102,10 +80,6 @@ public class Vala.Delegate : TypeSymbol {
public Delegate (string? name, DataType return_type, SourceReference? source_reference = null, Comment? comment = null) {
base (name, source_reference, comment);
this.return_type = return_type;
-
- // error is -1 (right of user_data)
- carray_length_parameter_position = -3;
- cdelegate_target_parameter_position = -3;
}
/**
@@ -139,12 +113,6 @@ public class Vala.Delegate : TypeSymbol {
* @param param a formal parameter
*/
public void add_parameter (Parameter param) {
- // default C parameter position
- param.cparameter_position = parameters.size + 1;
- param.carray_length_parameter_position = param.cparameter_position + 0.1;
- param.cdelegate_target_parameter_position = param.cparameter_position + 0.1;
- param.cdestroy_notify_parameter_position = param.cparameter_position + 0.1;
-
parameters.add (param);
scope.add (param.name, param);
}
@@ -256,29 +224,12 @@ public class Vala.Delegate : TypeSymbol {
}
}
- private void process_ccode_attribute (Attribute a) {
- if (a.has_argument ("array_length_type")) {
- array_length_type = a.get_string ("array_length_type");
- }
- if (a.has_argument ("array_null_terminated")) {
- array_null_terminated = a.get_bool ("array_null_terminated");
- }
- if (a.has_argument ("array_length_pos")) {
- carray_length_parameter_position = a.get_double ("array_length_pos");
- }
- if (a.has_argument ("delegate_target_pos")) {
- cdelegate_target_parameter_position = a.get_double ("delegate_target_pos");
- }
- }
-
/**
* Process all associated attributes.
*/
public void process_attributes () {
foreach (Attribute a in attributes) {
- if (a.name == "CCode") {
- process_ccode_attribute (a);
- } else if (a.name == "Deprecated") {
+ if (a.name == "Deprecated") {
process_deprecated_attribute (a);
} else if (a.name == "Experimental") {
process_experimental_attribute (a);
diff --git a/vala/valagirparser.vala b/vala/valagirparser.vala
index 30167b0..9c52dac 100644
--- a/vala/valagirparser.vala
+++ b/vala/valagirparser.vala
@@ -1436,16 +1436,9 @@ public class Vala.GirParser : CodeVisitor {
}
void set_array_ccode (Symbol sym, ParameterInfo info) {
- if (sym is Method) {
- var m = (Method) sym;
- m.carray_length_parameter_position = info.vala_idx;
- } else if (sym is Delegate) {
- var d = (Delegate) sym;
- d.carray_length_parameter_position = info.vala_idx;
- } else {
- var param = (Parameter) sym;
- param.carray_length_parameter_position = info.vala_idx;
- param.set_array_length_cname (info.param.name);
+ sym.set_attribute_double ("CCode", "array_length_pos", info.vala_idx);
+ if (sym is Parameter) {
+ sym.set_attribute_string ("CCode", "array_length_cname", info.param.name);
}
var type_name = info.param.variable_type.to_qualified_string ();
if (type_name != "int") {
@@ -1453,7 +1446,7 @@ public class Vala.GirParser : CodeVisitor {
if (st != null) {
if (sym is Method) {
var m = (Method) sym;
- m.array_length_type = st.get_cname ();
+ m.set_attribute_string ("CCode", "array_length_type", st.get_cname ());
} else {
var param = (Parameter) sym;
param.array_length_type = st.get_cname ();
@@ -1928,7 +1921,9 @@ public class Vala.GirParser : CodeVisitor {
}
param = new Parameter (name, type, get_current_src ());
- param.ctype = ctype;
+ if (ctype != null) {
+ param.set_attribute_string ("CCode", "type", ctype);
+ }
if (direction == "out") {
param.direction = ParameterDirection.OUT;
} else if (direction == "inout") {
@@ -2508,12 +2503,8 @@ public class Vala.GirParser : CodeVisitor {
if (return_no_array_length) {
s.set_attribute_bool ("CCode", "array_length", false);
}
- if (s is Method) {
- var m = (Method) s;
- m.array_null_terminated = return_array_null_terminated;
- } else if (s is Delegate) {
- var d = (Delegate) s;
- d.array_null_terminated = return_array_null_terminated;
+ if (return_array_null_terminated) {
+ s.set_attribute_bool ("CCode", "array_null_terminated", true);
}
}
current.return_array_length_idx = return_array_length_idx;
@@ -2952,14 +2943,14 @@ public class Vala.GirParser : CodeVisitor {
Report.error (get_current_src (), "invalid closure index");
continue;
}
- info.param.cdelegate_target_parameter_position = parameters[info.closure_idx].vala_idx;
+ info.param.set_attribute_double ("CCode", "delegate_target_pos", parameters[info.closure_idx].vala_idx);
}
if (info.destroy_idx != -1) {
if (info.destroy_idx >= parameters.size) {
Report.error (get_current_src (), "invalid destroy index");
continue;
}
- info.param.cdestroy_notify_parameter_position = parameters[info.destroy_idx].vala_idx;
+ info.param.set_attribute_double ("CCode", "destroy_notify_pos", parameters[info.destroy_idx].vala_idx);
}
}
}
@@ -3098,13 +3089,14 @@ public class Vala.GirParser : CodeVisitor {
// put cancellable as last parameter
Parameter cancellable = null;
bool is_cancellable_last = false;
- double cancellable_pos = -1;
+ double cancellable_pos = 1;
foreach (var param in method.get_parameters ()) {
if (param.name == "cancellable" && param.variable_type.to_qualified_string () == "GLib.Cancellable?" && param.direction == ParameterDirection.IN) {
cancellable = param;
cancellable.initializer = new NullLiteral (param.source_reference);
- cancellable_pos = cancellable.cparameter_position;
+ break;
}
+ cancellable_pos++;
}
if (cancellable != null) {
if (method.get_parameters().get (method.get_parameters().size - 1) == cancellable) {
@@ -3141,7 +3133,9 @@ public class Vala.GirParser : CodeVisitor {
if (a != null && a.has_argument ("array_length")) {
method.set_attribute_bool ("CCode", "array_length", a.get_bool ("array_length"));
}
- method.array_null_terminated = finish_method.array_null_terminated;
+ if (a != null && a.has_argument ("array_null_terminated")) {
+ method.set_attribute_bool ("CCode", "array_null_terminated", a.get_bool ("array_null_terminated"));
+ }
foreach (var param in finish_method.get_parameters ()) {
if (param.direction == ParameterDirection.OUT) {
@@ -3165,7 +3159,7 @@ public class Vala.GirParser : CodeVisitor {
if (cancellable != null) {
method.add_parameter (cancellable);
if (!is_cancellable_last) {
- cancellable.cparameter_position = cancellable_pos;
+ cancellable.set_attribute_double ("CCode", "pos", cancellable_pos);
} else {
// avoid useless bloat in the vapi
}
diff --git a/vala/valalambdaexpression.vala b/vala/valalambdaexpression.vala
index c4105bd..57033c8 100644
--- a/vala/valalambdaexpression.vala
+++ b/vala/valalambdaexpression.vala
@@ -136,8 +136,6 @@ public class Vala.LambdaExpression : Expression {
var return_type = cb.return_type.get_actual_type (target_type, null, this);
method = new Method (get_lambda_name (context), return_type, source_reference);
method.attributes = cb.attributes.copy ();
- method.array_null_terminated = cb.array_null_terminated;
- method.array_length_type = cb.array_length_type;
// track usage for flow analyzer
method.used = true;
method.check_deprecated (source_reference);
diff --git a/vala/valamethod.vala b/vala/valamethod.vala
index e53dd81..ed9e6d4 100644
--- a/vala/valamethod.vala
+++ b/vala/valamethod.vala
@@ -133,28 +133,6 @@ public class Vala.Method : Subroutine {
public Parameter this_parameter { get; set; }
/**
- * Specifies the position of the array length out parameter in the C
- * function.
- */
- public double carray_length_parameter_position { get; set; }
-
- /**
- * Specifies the position of the delegate target out parameter in the C
- * function.
- */
- public double cdelegate_target_parameter_position { get; set; }
-
- /**
- * Specifies whether the array is null terminated.
- */
- public bool array_null_terminated { get; set; }
-
- /**
- * Specifies a custom type for the array length parameter.
- */
- public string? array_length_type { get; set; default = null; }
-
- /**
* Specifies a custom C return type for this method.
*/
public string? custom_return_type_cname { get; set; }
@@ -226,9 +204,6 @@ public class Vala.Method : Subroutine {
public Method (string? name, DataType return_type, SourceReference? source_reference = null, Comment? comment = null) {
base (name, source_reference, comment);
this.return_type = return_type;
-
- carray_length_parameter_position = -3;
- cdelegate_target_parameter_position = -3;
}
/**
@@ -238,11 +213,6 @@ public class Vala.Method : Subroutine {
*/
public void add_parameter (Parameter param) {
// default C parameter position
- param.cparameter_position = parameters.size + 1;
- param.carray_length_parameter_position = param.cparameter_position + 0.1;
- param.cdelegate_target_parameter_position = param.cparameter_position + 0.1;
- param.cdestroy_notify_parameter_position = param.cparameter_position + 0.1;
-
parameters.add (param);
scope.add (param.name, param);
}
@@ -309,18 +279,6 @@ public class Vala.Method : Subroutine {
if (a.has_argument ("sentinel")) {
this.sentinel = a.get_string ("sentinel");
}
- if (a.has_argument ("array_length_type")) {
- array_length_type = a.get_string ("array_length_type");
- }
- if (a.has_argument ("array_null_terminated")) {
- array_null_terminated = a.get_bool ("array_null_terminated");
- }
- if (a.has_argument ("array_length_pos")) {
- carray_length_parameter_position = a.get_double ("array_length_pos");
- }
- if (a.has_argument ("delegate_target_pos")) {
- cdelegate_target_parameter_position = a.get_double ("delegate_target_pos");
- }
if (a.has_argument ("has_new_function")) {
has_new_function = a.get_bool ("has_new_function");
}
diff --git a/vala/valaparameter.vala b/vala/valaparameter.vala
index 256c0fd..4f42ca2 100644
--- a/vala/valaparameter.vala
+++ b/vala/valaparameter.vala
@@ -42,30 +42,6 @@ public class Vala.Parameter : Variable {
*/
public bool params_array { get; set; }
- /**
- * Specifies the position of the parameter in the C function.
- */
- public double cparameter_position { get; set; }
-
- /**
- * Specifies the position of the array length parameter in the C
- * function.
- */
- public double carray_length_parameter_position { get; set; }
-
- /**
- * Specifies the position of the delegate target parameter in the C
- * function.
- */
- public double cdelegate_target_parameter_position { get; set; }
-
- public double cdestroy_notify_parameter_position { get; set; }
-
- /**
- * Specifies the type of the parameter in the C function.
- */
- public string? ctype { get; set; }
-
public bool captured { get; set; }
/**
@@ -119,37 +95,6 @@ public class Vala.Parameter : Variable {
}
}
- private void process_ccode_attribute (Attribute a) {
- if (a.has_argument ("type")) {
- ctype = a.get_string ("type");
- }
- if (a.has_argument ("pos")) {
- cparameter_position = a.get_double ("pos");
- }
- if (a.has_argument ("array_length_pos")) {
- carray_length_parameter_position = a.get_double ("array_length_pos");
- }
- if (a.has_argument ("delegate_target_pos")) {
- cdelegate_target_parameter_position = a.get_double ("delegate_target_pos");
- }
- if (a.has_argument ("destroy_notify_pos")) {
- cdestroy_notify_parameter_position = a.get_double ("destroy_notify_pos");
- }
- }
-
- /**
- * Process all associated attributes.
- */
- public override void process_attributes () {
- base.process_attributes ();
-
- foreach (Attribute a in attributes) {
- if (a.name == "CCode") {
- process_ccode_attribute (a);
- }
- }
- }
-
public Parameter copy () {
if (!ellipsis) {
var result = new Parameter (name, variable_type, source_reference);
@@ -158,7 +103,7 @@ public class Vala.Parameter : Variable {
result.initializer = this.initializer;
result.attributes = this.attributes.copy ();
result.no_delegate_target = this.no_delegate_target;
- result.array_null_terminated = this.array_null_terminated;
+ result.attributes = attributes.copy ();
return result;
} else {
return new Parameter.with_ellipsis ();
diff --git a/vala/valasignal.vala b/vala/valasignal.vala
index 614ff0b..d811a88 100644
--- a/vala/valasignal.vala
+++ b/vala/valasignal.vala
@@ -101,12 +101,6 @@ public class Vala.Signal : Symbol, Lockable {
* @param param a formal parameter
*/
public void add_parameter (Parameter param) {
- // default C parameter position
- param.cparameter_position = parameters.size + 1;
- param.carray_length_parameter_position = param.cparameter_position + 0.1;
- param.cdelegate_target_parameter_position = param.cparameter_position + 0.1;
- param.cdestroy_notify_parameter_position = param.cparameter_position + 0.1;
-
parameters.add (param);
scope.add (param.name, param);
}
diff --git a/vapigen/valagidlparser.vala b/vapigen/valagidlparser.vala
index 6a12bb4..fb3475a 100644
--- a/vapigen/valagidlparser.vala
+++ b/vapigen/valagidlparser.vala
@@ -2373,7 +2373,7 @@ public class Vala.GIdlParser : CodeVisitor {
} else if (nv[0] == "type_name") {
p.variable_type = param_type = parse_type_from_string (eval (nv[1]), false);
} else if (nv[0] == "ctype") {
- p.ctype = eval (nv[1]);
+ p.set_attribute_string ("CCode", "type", eval (nv[1]));
} else if (nv[0] == "type_arguments") {
parse_type_arguments_from_string (param_type, eval (nv[1]));
} else if (nv[0] == "default_value") {
@@ -2779,7 +2779,7 @@ public class Vala.GIdlParser : CodeVisitor {
}
if (ctype != null) {
- field.set_ctype (ctype);
+ field.set_attribute_string ("CCode", "type", ctype);
}
if (cheader_filename != null) {
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]