[vala/parallel] add --use-fast-vapi= flag to compiler



commit c53cf281aea3369d7bcbda45f1f3474dcd11d228
Author: Ryan Lortie <desrt desrt ca>
Date:   Sun Aug 22 15:07:54 2010 -0400

    add --use-fast-vapi= flag to compiler
    
    do some strange fixes that seem to make it work

 codegen/valaccodebasemodule.vala |    4 ++--
 compiler/valacompiler.vala       |   17 +++++++++++++++++
 vala/valaconstant.vala           |    2 +-
 vala/valapropertyaccessor.vala   |    2 +-
 4 files changed, 21 insertions(+), 4 deletions(-)
---
diff --git a/codegen/valaccodebasemodule.vala b/codegen/valaccodebasemodule.vala
index 520e098..ae1cc23 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.external_package) {
+			if (file.filename.has_suffix ("vala")) {
 				file.accept (this);
 			}
 		}
@@ -843,7 +843,7 @@ public class Vala.CCodeBaseModule : CodeGenerator {
 			return;
 		}
 
-		if (!c.external) {
+		if (!c.external_package) {
 			generate_type_declaration (c.type_reference, decl_space);
 
 			c.value.emit (this);
diff --git a/compiler/valacompiler.vala b/compiler/valacompiler.vala
index 9f04372..822110d 100644
--- a/compiler/valacompiler.vala
+++ b/compiler/valacompiler.vala
@@ -38,6 +38,8 @@ class Vala.Compiler {
 	static string gir;
 	[CCode (array_length = false, array_null_terminated = true)]
 	static string[] packages;
+	[CCode (array_length = false, array_null_terminated = true)]
+	static string[] fast_vapis;
 	static string target_glib;
 
 	static bool ccode_only;
@@ -97,6 +99,7 @@ class Vala.Compiler {
 		{ "internal-header", 'h', 0, OptionArg.FILENAME, ref internal_header_filename, "Output internal C header file", "FILE" },
 		{ "internal-vapi", 0, 0, OptionArg.FILENAME, ref internal_vapi_filename, "Output vapi with internal api", "FILE" },
 		{ "fast-vapi", 0, 0, OptionArg.STRING, ref fast_vapi_filename, "Output vapi without performing symbol resolution", null },
+		{ "use-fast-vapi", 0, 0, OptionArg.STRING_ARRAY, ref fast_vapis, "Use --fast-vapi output during this compile", null },
 		{ "symbols", 0, 0, OptionArg.FILENAME, ref symbols_filename, "Output symbols file", "FILE" },
 		{ "compile", 'c', 0, OptionArg.NONE, ref compile_only, "Compile but do not link", null },
 		{ "output", 'o', 0, OptionArg.FILENAME, ref output, "Place output in file FILE", "FILE" },
@@ -328,6 +331,16 @@ class Vala.Compiler {
 			packages = null;
 		}
 
+		var fast_vapi_list = new GLib.List<SourceFile> ();
+		if (fast_vapis != null) {
+			foreach (string vapi in fast_vapis) {
+				var rpath = realpath (vapi);
+				var source_file = new SourceFile (context, rpath, true);
+				fast_vapi_list.prepend (source_file);
+				context.add_source_file (source_file);
+			}
+		}
+
 		if (context.report.get_errors () > 0) {
 			return quit ();
 		}
@@ -397,6 +410,10 @@ class Vala.Compiler {
 		var gir_parser = new GirParser ();
 		gir_parser.parse (context);
 
+		foreach (var source_file in fast_vapi_list) {
+			source_file.external_package = false;
+		}
+
 		if (gir_parser.get_package_names != null) {
 			foreach (var pkg in gir_parser.get_package_names ()) {
 				context.add_package (pkg);
diff --git a/vala/valaconstant.vala b/vala/valaconstant.vala
index 02b815f..d84f941 100644
--- a/vala/valaconstant.vala
+++ b/vala/valaconstant.vala
@@ -188,7 +188,7 @@ public class Vala.Constant : Symbol, Lockable {
 			return false;
 		}
 
-		if (!external) {
+		if (!external_package) {
 			if (value == null) {
 				error = true;
 				Report.error (source_reference, "A const field requires a value to be provided");
diff --git a/vala/valapropertyaccessor.vala b/vala/valapropertyaccessor.vala
index ee65a99..55eab2c 100644
--- a/vala/valapropertyaccessor.vala
+++ b/vala/valapropertyaccessor.vala
@@ -187,7 +187,7 @@ public class Vala.PropertyAccessor : Symbol {
 
 		analyzer.current_symbol = this;
 
-		if (!prop.external_package) {
+		if (!prop.external) {
 			if (body == null && !prop.interface_only && !prop.is_abstract) {
 				/* no accessor body specified, insert default body */
 



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