]> git.ipfire.org Git - thirdparty/vala.git/commitdiff
codegen: Run partial codegen on fast vapi files
authorRyan Lortie <desrt@desrt.ca>
Sat, 28 Aug 2010 13:11:24 +0000 (15:11 +0200)
committerJürg Billeter <j@bitron.ch>
Fri, 17 Sep 2010 23:00:14 +0000 (01:00 +0200)
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
codegen/valaccodemethodmodule.vala

index 231e1f575fdcc4e10aa56a329a8ae90d9427ca4a..a7d7307a5797221017fca8f65a0efee1b2418267 100644 (file)
@@ -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) {
index 4232ab437bcefe9cd268a8555a3d073790056d96..8e4668773b969c17abb0fcf86e9a29bc86d3a527 100644 (file)
@@ -1070,6 +1070,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;