]> git.ipfire.org Git - thirdparty/vala.git/commitdiff
Allow access to head and codegen from CCode modules
authorJürg Billeter <j@bitron.ch>
Fri, 24 Oct 2008 09:47:32 +0000 (09:47 +0000)
committerJürg Billeter <juergbi@src.gnome.org>
Fri, 24 Oct 2008 09:47:32 +0000 (09:47 +0000)
2008-10-24  Jürg Billeter  <j@bitron.ch>

* gobject/valaccodebasemodule.vala:
* gobject/valaccodegenerator.vala:
* gobject/valaccodemodule.vala:

Allow access to head and codegen from CCode modules

svn path=/trunk/; revision=1884

ChangeLog
gobject/valaccodebasemodule.vala
gobject/valaccodegenerator.vala
gobject/valaccodemodule.vala

index 36559b0e1a7378b6640064cec13c6dd82415a325..1d02e62dd12e2cfcc465805743765d7f42802f07 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,11 @@
+2008-10-24  Jürg Billeter  <j@bitron.ch>
+
+       * gobject/valaccodebasemodule.vala:
+       * gobject/valaccodegenerator.vala:
+       * gobject/valaccodemodule.vala:
+
+       Allow access to head and codegen from CCode modules
+
 2008-10-24  Jürg Billeter  <j@bitron.ch>
 
        * vala/valacodegenerator.vala:
index 9fef4a18e5254c136be951ce690bbbeae0077a8b..43b9aa215040b4437abfdbaa55344fbf797e4615 100644 (file)
@@ -24,7 +24,7 @@
  * Code visitor generating C Code.
  */
 public class Vala.CCodeBaseModule : CCodeModule {
-       public CCodeBaseModule (CCodeModule? next) {
-               base (next);
+       public CCodeBaseModule (CCodeGenerator codegen, CCodeModule? next) {
+               base (codegen, next);
        }
 }
index 9ad07426072d9a350f907e455298a89a64c7400b..19db446a1be8731c87902ec08b6414d64ee0e0ed 100644 (file)
@@ -141,7 +141,7 @@ public class Vala.CCodeGenerator : CodeGenerator {
        private Set<string> wrappers;
 
        public CCodeGenerator () {
-               this.head = new CCodeBaseModule (null);
+               this.head = new CCodeBaseModule (this, null);
 
                predefined_marshal_set = new HashSet<string> (str_hash, str_equal);
                predefined_marshal_set.add ("VOID:VOID");
index d78de0a9dd59587eea3b95b46333c20d8cb6b0a4..847c5fe434210d82b1826167f1cd95b83c82aa9c 100644 (file)
@@ -26,12 +26,26 @@ using Gee;
  * Code visitor generating C Code.
  */
 public abstract class Vala.CCodeModule {
-       public weak CCodeModule head { get; private set; }
+       public weak CCodeGenerator codegen { get; private set; }
 
-       public CCodeModule? next { get; private set; }
+       public CCodeModule head {
+               get { return _head; }
+               private set {
+                       _head = value;
+                       // propagate head property to all modules
+                       if (next != null) {
+                               next.head = value;
+                       }
+               }
+       }
+
+       weak CCodeModule _head;
+       CCodeModule? next;
 
-       public CCodeModule (CCodeModule? next) {
+       public CCodeModule (CCodeGenerator codegen, CCodeModule? next) {
+               this.codegen = codegen;
                this.next = next;
+               this.head = this;
        }
 
        public virtual void emit (CodeContext context) {