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

add vfunc_name attribute, patch by Philip Van Hoof

2007-08-09  Juerg Billeter  <j@bitron.ch>

	* vala/valamethod.vala, gobject/valacodegeneratorclass.vala,
	  gobject/valacodegeneratormethod.vala: add vfunc_name attribute,
	  patch by Philip Van Hoof

svn path=/trunk/; revision=453
parent 7b207a0b
2007-08-09 Jürg Billeter <j@bitron.ch>
* vala/valamethod.vala, gobject/valacodegeneratorclass.vala,
gobject/valacodegeneratormethod.vala: add vfunc_name attribute,
patch by Philip Van Hoof
2007-08-08 Jürg Billeter <j@bitron.ch>
* tests/testrunner.sh: set G_DEBUG=fatal_warnings
......
......@@ -216,7 +216,7 @@ public class Vala.CodeGenerator {
var ccast = new CCodeFunctionCall (new CCodeIdentifier ("%s_CLASS".printf (((Class) base_type).get_upper_case_cname (null))));
ccast.add_argument (new CCodeIdentifier ("klass"));
init_block.add_statement (new CCodeExpressionStatement (new CCodeAssignment (new CCodeMemberAccess.pointer (ccast, m.name), new CCodeIdentifier (m.get_real_cname ()))));
init_block.add_statement (new CCodeExpressionStatement (new CCodeAssignment (new CCodeMemberAccess.pointer (ccast, m.base_method.vfunc_name), new CCodeIdentifier (m.get_real_cname ()))));
}
/* create dup_func and destroy_func properties for generic types */
......@@ -323,7 +323,7 @@ public class Vala.CodeGenerator {
}
var ciface = new CCodeIdentifier ("iface");
init_block.add_statement (new CCodeExpressionStatement (new CCodeAssignment (new CCodeMemberAccess.pointer (ciface, m.name), new CCodeIdentifier (m.get_real_cname ()))));
init_block.add_statement (new CCodeExpressionStatement (new CCodeAssignment (new CCodeMemberAccess.pointer (ciface, m.base_interface_method.vfunc_name), new CCodeIdentifier (m.get_real_cname ()))));
}
source_type_member_definition.append (iface_init);
......
......@@ -119,7 +119,7 @@ public class Vala.CodeGenerator {
if (m.is_abstract || m.is_virtual) {
var vdecl = new CCodeDeclaration (m.return_type.get_cname ());
vdeclarator = new CCodeFunctionDeclarator (m.name);
vdeclarator = new CCodeFunctionDeclarator (m.vfunc_name);
vdecl.add_declarator (vdeclarator);
type_struct.add_declaration (vdecl);
......@@ -332,7 +332,7 @@ public class Vala.CodeGenerator {
}
vcast.add_argument (new CCodeIdentifier ("self"));
var vcall = new CCodeFunctionCall (new CCodeMemberAccess.pointer (vcast, m.name));
var vcall = new CCodeFunctionCall (new CCodeMemberAccess.pointer (vcast, m.vfunc_name));
vcall.add_argument (new CCodeIdentifier ("self"));
var params = m.get_parameters ();
......
......@@ -55,6 +55,22 @@ public class Vala.Method : Member, Invokable {
_instance = value;
}
}
/**
* The name of the vfunc of this method as it is used in C code.
*/
public string! vfunc_name {
get {
if (_vfunc_name == null) {
_vfunc_name = this.name;
}
return _vfunc_name;
}
set {
_vfunc_name = value;
}
}
/**
* Specifies whether this method is abstract. Abstract methods have no
......@@ -135,6 +151,7 @@ public class Vala.Method : Member, Invokable {
private bool _instance = true;
private Gee.List<FormalParameter> parameters = new ArrayList<FormalParameter> ();
private string cname;
private string _vfunc_name;
private bool _no_array_length;
private Gee.List<TypeReference> error_domains = new ArrayList<TypeReference> ();
......@@ -258,6 +275,9 @@ public class Vala.Method : Member, Invokable {
add_cheader_filename (filename);
}
}
if (a.has_argument ("vfunc_name")) {
this.vfunc_name = a.get_string ("vfunc_name");
}
}
/**
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment