[vala/0.10-parallel] SourceFile: change the definition of 'used'



commit 2f3f9622f30facba85ca2396dc4f6c0ce0725687
Author: Ryan Lortie <desrt desrt ca>
Date:   Mon Sep 20 06:56:32 2010 -0400

    SourceFile: change the definition of 'used'
    
    Consider a source file as used only if actual C code (or declarations)
    have been generated from something in that source file.
    
    This greatly reduces the number of dependencies listed for compilations
    that touch a large number of symbols in trivial ways without really
    making use of them (for example, when listing a very large number of
    unused fast-vapi files, as parvala does).

 codegen/valaccodedeclarationspace.vala |    1 +
 vala/valasourcefile.vala               |    2 +-
 vala/valasymbol.vala                   |   11 +----------
 3 files changed, 3 insertions(+), 11 deletions(-)
---
diff --git a/codegen/valaccodedeclarationspace.vala b/codegen/valaccodedeclarationspace.vala
index 4ff7640..7c13be7 100644
--- a/codegen/valaccodedeclarationspace.vala
+++ b/codegen/valaccodedeclarationspace.vala
@@ -44,6 +44,7 @@ public class Vala.CCodeDeclarationSpace {
 		if (add_declaration (name)) {
 			return true;
 		}
+		sym.source_reference.file.used = true;
 		if (sym.external_package || (!is_header && CodeContext.get ().use_header && !sym.is_internal_symbol ())) {
 			// add appropriate include file
 			foreach (string header_filename in sym.get_cheader_filenames ()) {
diff --git a/vala/valasourcefile.vala b/vala/valasourcefile.vala
index 28397cf..9bb225f 100644
--- a/vala/valasourcefile.vala
+++ b/vala/valasourcefile.vala
@@ -69,7 +69,7 @@ public class Vala.SourceFile {
 
 	/**
 	 * If the file has been used (ie: if anything in the file has
-	 * been found by symbol resolution).
+	 * been emitted into C code as a definition or declaration).
 	 */
 	public bool used { get; set; }
 
diff --git a/vala/valasymbol.vala b/vala/valasymbol.vala
index 9caaa27..b636624 100644
--- a/vala/valasymbol.vala
+++ b/vala/valasymbol.vala
@@ -97,16 +97,7 @@ public abstract class Vala.Symbol : CodeNode {
 	/**
 	 * Specifies whether this symbol has been accessed.
 	 */
-	public bool used {
-		get { return _used; }
-		set {
-			_used = value;
-			if (_used && source_reference != null) {
-				source_reference.file.used = true;
-			 }
-		}
-	}
-	bool _used;
+	public bool used { get; set; }
 
 	/**
 	 * Specifies the accessibility of this symbol. Public accessibility



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