]> 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>
Thu, 9 Sep 2010 13:54:18 +0000 (15:54 +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 8bb281dceea963c7a0d392635578c424e9f391c2..1fe41ffd1f50165424d43cc6974428c56085c4c5 100644 (file)
@@ -417,7 +417,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);
                        }
                }
@@ -611,6 +611,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 ();
                }
@@ -1354,6 +1362,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 a1d54d73f9d8df8a3fefd0f28fc9bfa9b22e8d08..4d4b1275a660cd61cebfc89f9dc1c5783e9950cb 100644 (file)
@@ -1007,6 +1007,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;