]> git.ipfire.org Git - thirdparty/vala.git/commitdiff
fix order in C header file test public delegate
authorJuerg Billeter <j@bitron.ch>
Wed, 11 Jul 2007 14:23:50 +0000 (14:23 +0000)
committerJürg Billeter <juergbi@src.gnome.org>
Wed, 11 Jul 2007 14:23:50 +0000 (14:23 +0000)
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

ChangeLog
ccode/valaccodefragment.vala
ccode/valaccodenode.vala
ccode/valaccodeoncesection.vala
gobject/valacodegenerator.vala
gobject/valacodegeneratorsourcefile.vala
tests/test-014.out
tests/test-014.vala

index a7d4344b4c53830ae28e2f8323d48ec848aba25f..1a64d04d1524d38177072a300af1df5e7c71389d 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,12 @@
+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
index b344383f0421e3347a243fe33042045dd47a9fe9..86ed0d59237b5b841d3879d4c0ee19510f8c1520 100644 (file)
@@ -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);
+               }
+       }
 }
index 77c66d420df87167f726d4729a40e6b012eabdcd..18240a697406c7ee46df5b4d3d474dea34917ca7 100644 (file)
@@ -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);
+       }
 }
index 5d0ceff349bdede73d340f20da5990ad32bf43a6..f049d8d2ac7aecb4b6b775c91f01d75857a4c14b 100644 (file)
@@ -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");
index 70faaaa9b86035f90b2e0a862b91570f51c38b87..3d1ae542bc7ddea7a34b3a0b6583aa84a931e37c 100644 (file)
@@ -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);
                }
index f29c89802ff7467d46f6c1626b609016daf3de4b..a3b7f3e58278f5488425d830e0336ba8a59b0500 100644 (file)
@@ -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 ();
                
index 3be1de6cecc3adc82f20e1d07ed74c4462366a90..4f3a6b477cbf6be0ff8c09c86e6d15c97ac705d7 100644 (file)
@@ -1 +1 @@
-Callback Test: 1 2 3
+Delegate Test: 1 2 3
index 30b727b6b4cbca856f6d8a043ed6aa92646147fe..5ac7f87fcb325abedeed0af7a7171e4553811eba 100644 (file)
@@ -1,6 +1,6 @@
 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;