[vala/parallel-0.10: 35/37] codegen: Run partial codegen on fast vapi files



commit f7ac322fdd05f2ed2097577450917df3eb1bded4
Author: Ryan Lortie <desrt desrt ca>
Date:   Sat Aug 28 15:11:24 2010 +0200

    codegen: Run partial codegen on fast vapi files
    
    Run the C code generator for fast-vapi files in order to populate the
    header file.  Add some early-exits to avoid doing unnecessary work (and
    to avoid crashes caused by assumptions that there will actually be
    code to output).

 codegen/valaccodebasemodule.vala   |   14 +++++++++++++-
 codegen/valaccodemethodmodule.vala |    5 +++++
 2 files changed, 18 insertions(+), 1 deletions(-)
---
diff --git a/codegen/valaccodebasemodule.vala b/codegen/valaccodebasemodule.vala
index 496e20b..ec1ee1f 100644
--- a/codegen/valaccodebasemodule.vala
+++ b/codegen/valaccodebasemodule.vala
@@ -420,7 +420,7 @@ public class Vala.CCodeBaseModule : CodeGenerator {
 		/* we're only interested in non-pkg source files */
 		var source_files = context.get_source_files ();
 		foreach (SourceFile file in source_files) {
-			if (file.file_type == SourceFileType.SOURCE) {
+			if (file.file_type != SourceFileType.PACKAGE) {
 				file.accept (this);
 			}
 		}
@@ -655,6 +655,14 @@ public class Vala.CCodeBaseModule : CodeGenerator {
 			return;
 		}
 
+		/* For fast-vapi, we only wanted the header declarations
+		 * to be emitted, so bail out here without writing the
+		 * C code output.
+		 */
+		if (source_file.file_type == SourceFileType.FAST) {
+			return;
+		}
+
 		if (requires_array_free) {
 			append_vala_array_free ();
 		}
@@ -1446,6 +1454,10 @@ public class Vala.CCodeBaseModule : CodeGenerator {
 			}
 		}
 
+		if (acc.source_type == SourceFileType.FAST) {
+			return;
+		}
+
 		var this_type = get_data_type_for_symbol (t);
 		var cselfparam = new CCodeFormalParameter ("self", this_type.get_cname ());
 		if (t is Struct) {
diff --git a/codegen/valaccodemethodmodule.vala b/codegen/valaccodemethodmodule.vala
index 0df172f..68f7272 100644
--- a/codegen/valaccodemethodmodule.vala
+++ b/codegen/valaccodemethodmodule.vala
@@ -1066,6 +1066,11 @@ public class Vala.CCodeMethodModule : CCodeStructModule {
 		bool visible = !m.is_private_symbol ();
 
 		visit_method (m);
+
+		if (m.source_type == SourceFileType.FAST) {
+			return;
+		}
+
 		function = (CCodeFunction) m.ccodenode;
 
 		DataType creturn_type;



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