[vala] Fix GTypeModule-based plugins



commit a002d00095ce0c2b6e0d73c2dc176381c6cd0aca
Author: Jürg Billeter <j bitron ch>
Date:   Wed Jul 8 11:40:04 2009 +0100

    Fix GTypeModule-based plugins

 codegen/valagtypemodule.vala          |    1 +
 codegen/valatyperegisterfunction.vala |   14 +++++++++-----
 2 files changed, 10 insertions(+), 5 deletions(-)
---
diff --git a/codegen/valagtypemodule.vala b/codegen/valagtypemodule.vala
index a38954c..7ac0ed2 100644
--- a/codegen/valagtypemodule.vala
+++ b/codegen/valagtypemodule.vala
@@ -529,6 +529,7 @@ internal class Vala.GTypeModule : GErrorModule {
 
 			var type_fun = new ClassRegisterFunction (cl, context);
 			type_fun.init_from_type (in_plugin);
+			source_declarations.add_type_member_declaration (type_fun.get_source_declaration ());
 			source_type_member_definition.append (type_fun.get_definition ());
 			
 			if (in_plugin) {
diff --git a/codegen/valatyperegisterfunction.vala b/codegen/valatyperegisterfunction.vala
index 85dfcc0..736883f 100644
--- a/codegen/valatyperegisterfunction.vala
+++ b/codegen/valatyperegisterfunction.vala
@@ -1,6 +1,6 @@
 /* valatyperegisterfunction.vala
  *
- * Copyright (C) 2006-2008  Jürg Billeter
+ * Copyright (C) 2006-2009  Jürg Billeter
  *
  * This library is free software; you can redistribute it and/or
  * modify it under the terms of the GNU Lesser General Public
@@ -26,9 +26,9 @@ using GLib;
  * C function to register a type at runtime.
  */
 public abstract class Vala.TypeRegisterFunction {
-	private CCodeFragment declaration_fragment = new CCodeFragment ();
-
-	private CCodeFragment definition_fragment = new CCodeFragment ();
+	CCodeFragment source_declaration_fragment = new CCodeFragment ();
+	CCodeFragment declaration_fragment = new CCodeFragment ();
+	CCodeFragment definition_fragment = new CCodeFragment ();
 
 	public CodeContext context { get; set; }
 
@@ -62,7 +62,7 @@ public abstract class Vala.TypeRegisterFunction {
 		if (!plugin) {
 			type_block.add_statement (cdecl);
 		} else {
-			definition_fragment.append (cdecl);
+			source_declaration_fragment.append (cdecl);
 		}
 
 		CCodeFunction fun;
@@ -366,6 +366,10 @@ public abstract class Vala.TypeRegisterFunction {
 	 */
 	public abstract CCodeFragment get_type_interface_init_statements ();
 	
+	public CCodeFragment get_source_declaration () {
+		return source_declaration_fragment;
+	}
+
 	/**
 	 * Returns the declaration for this type register function in C code.
 	 *



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]