[vala/parallel: 15/17] C codegen: run partial codegen on fast vapi files
- From: Ryan Lortie <ryanl src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [vala/parallel: 15/17] C codegen: run partial codegen on fast vapi files
- Date: Sun, 29 Aug 2010 22:22:17 +0000 (UTC)
commit f788cd088ae8ca78d203ae8a4002c20dfe407516
Author: Ryan Lortie <desrt desrt ca>
Date: Sat Aug 28 15:11:24 2010 +0200
C 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 8bb281d..7bc7149 100644
--- a/codegen/valaccodebasemodule.vala
+++ b/codegen/valaccodebasemodule.vala
@@ -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.SOURCE) {
+ return;
+ }
+
if (requires_array_free) {
append_vala_array_free ();
}
@@ -1354,6 +1362,10 @@ public class Vala.CCodeBaseModule : CodeGenerator {
}
}
+ if (acc.source_type != SourceFileType.SOURCE) {
+ 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 cef50c6..9e6e754 100644
--- a/codegen/valaccodemethodmodule.vala
+++ b/codegen/valaccodemethodmodule.vala
@@ -1003,6 +1003,11 @@ public class Vala.CCodeMethodModule : CCodeStructModule {
bool visible = !m.is_private_symbol ();
visit_method (m);
+
+ if (m.source_type != SourceFileType.SOURCE) {
+ return;
+ }
+
function = (CCodeFunction) m.ccodenode;
DataType creturn_type;
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]