[vala] SourceFile: change the definition of 'used'



commit 05f30005613af4ad0be8bad2f06d15a7257586c0
Author: Ryan Lortie <desrt desrt ca>
Date:   Wed Oct 6 22:40:40 2010 +0200

    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).
    
    Fixes bug 630144.

 codegen/valaccodebasemodule.vala |    1 +
 vala/valasourcefile.vala         |    2 +-
 vala/valasymbol.vala             |   11 +----------
 3 files changed, 3 insertions(+), 11 deletions(-)
---
diff --git a/codegen/valaccodebasemodule.vala b/codegen/valaccodebasemodule.vala
index 9b0f5a4..24c4dee 100644
--- a/codegen/valaccodebasemodule.vala
+++ b/codegen/valaccodebasemodule.vala
@@ -486,6 +486,7 @@ public class Vala.CCodeBaseModule : CodeGenerator {
 		if (decl_space.add_declaration (name)) {
 			return true;
 		}
+		sym.source_reference.file.used = true;
 		if (sym.external_package || (!decl_space.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 e65717b..7d822a1 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]