Commit bf8e760d authored by Jürg Billeter's avatar Jürg Billeter Committed by Jürg Billeter

fix order in C header file test public delegate

2007-07-11  Juerg Billeter  <j@bitron.ch>

	* ccode/valaccodefragment.vala, ccode/valaccodenode.vala,
	  ccode/valaccodeoncesection.vala, gobject/valacodegenerator.vala,
	  gobject/valacodegeneratorsourcefile.vala: fix order in C header file
	* tests/test-014.vala, tests/test-014.out: test public delegate

	Fixes bug 442703

svn path=/trunk/; revision=345
parent 20842807
2007-07-11 Jürg Billeter <j@bitron.ch>
* ccode/valaccodefragment.vala, ccode/valaccodenode.vala,
ccode/valaccodeoncesection.vala, gobject/valacodegenerator.vala,
gobject/valacodegeneratorsourcefile.vala: fix order in C header file
* tests/test-014.vala, tests/test-014.out: test public delegate
Fixes bug 442703
2007-07-11 Jürg Billeter <j@bitron.ch>
* vala/valaforeachstatement.vala: call visit_end_full_expression for
......
......@@ -57,4 +57,10 @@ public class Vala.CCodeFragment : CCodeNode {
node.write_declaration (writer);
}
}
public override void write_combined (CCodeWriter! writer) {
foreach (CCodeNode node in children) {
node.write_combined (writer);
}
}
}
......@@ -48,4 +48,15 @@ public abstract class Vala.CCodeNode {
*/
public virtual void write_declaration (CCodeWriter! writer) {
}
/**
* Writes declaration and implementation combined for this code node and
* all children with the specified C code writer.
*
* @param writer a C code writer
*/
public virtual void write_combined (CCodeWriter! writer) {
write_declaration (writer);
write (writer);
}
}
......@@ -44,10 +44,7 @@ public class Vala.CCodeOnceSection : CCodeFragment {
writer.write_string (define);
writer.write_newline ();
foreach (CCodeNode node in get_children ()) {
node.write_declaration (writer);
}
foreach (CCodeNode node in get_children ()) {
node.write (writer);
node.write_combined (writer);
}
writer.write_indent ();
writer.write_string ("#endif");
......
......@@ -314,7 +314,7 @@ public class Vala.CodeGenerator : CodeVisitor {
var ctypedef = new CCodeTypeDefinition (cb.return_type.get_cname (), cfundecl);
if (cb.access != MemberAccessibility.PRIVATE) {
header_type_declaration.append (ctypedef);
header_type_definition.append (ctypedef);
} else {
source_type_member_declaration.append (ctypedef);
}
......
......@@ -139,7 +139,6 @@ public class Vala.CodeGenerator {
once.append (new CCodeIdentifier ("G_END_DECLS"));
once.append (new CCodeNewline ());
once.append (new CCodeNewline ());
once.write_declaration (writer);
once.write (writer);
writer.close ();
......
Callback Test: 1 2 3
Delegate Test: 1 2 3
using GLib;
static delegate int Maman.ActionCallback ();
public static delegate int Maman.ActionCallback ();
class Maman.Bar {
static int do_action () {
......@@ -8,7 +8,7 @@ class Maman.Bar {
}
static int main (string[] args) {
stdout.printf ("Callback Test: 1");
stdout.printf ("Delegate Test: 1");
ActionCallback cb = do_action;
......
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