[vala/wip/gudev: 2/3] girparser: Fix reporting unused metadata



commit c2afbda889fb78f3f881925cf12e19e48bb563ae
Author: Luca Bruno <lucabru src gnome org>
Date:   Mon Aug 22 16:31:41 2011 +0200

    girparser: Fix reporting unused metadata

 vala/valagirparser.vala          |   24 +++++++++++++-----------
 vapi/metadata/Gedit-3.0.metadata |    2 --
 vapi/metadata/Rest-0.7.metadata  |    4 ++--
 3 files changed, 15 insertions(+), 15 deletions(-)
---
diff --git a/vala/valagirparser.vala b/vala/valagirparser.vala
index 81cf6a8..dd204a3 100644
--- a/vala/valagirparser.vala
+++ b/vala/valagirparser.vala
@@ -1018,6 +1018,7 @@ public class Vala.GirParser : CodeVisitor {
 
 	SourceFile current_source_file;
 	Node root;
+	ArrayList<Metadata> metadata_roots = new ArrayList<Metadata> ();
 
 	SourceLocation begin;
 	SourceLocation end;
@@ -1059,8 +1060,8 @@ public class Vala.GirParser : CodeVisitor {
 
 		root.process (this);
 
-		foreach (var node in root.members) {
-			report_unused_metadata (node.metadata);
+		foreach (var metadata in metadata_roots) {
+			report_unused_metadata (metadata);
 		}
 	}
 
@@ -1111,15 +1112,6 @@ public class Vala.GirParser : CodeVisitor {
 		metadata_stack = new ArrayList<Metadata> ();
 		metadata = Metadata.empty;
 
-		// load metadata, first look into metadata directories then in the same directory of the .gir.
-		string? metadata_filename = context.get_metadata_path (source_file.filename);
-		if (metadata_filename != null && FileUtils.test (metadata_filename, FileTest.EXISTS)) {
-			var metadata_parser = new MetadataParser ();
-			var metadata_file = new SourceFile (context, source_file.file_type, metadata_filename);
-			context.add_source_file (metadata_file);
-			metadata = metadata_parser.parse_metadata (metadata_file);
-		}
-
 		this.current_source_file = source_file;
 		reader = new MarkupReader (source_file.filename);
 
@@ -1752,6 +1744,16 @@ public class Vala.GirParser : CodeVisitor {
 			return;
 		}
 
+		// load metadata, first look into metadata directories then in the same directory of the .gir.
+		string? metadata_filename = context.get_metadata_path (current_source_file.filename);
+		if (metadata_filename != null && FileUtils.test (metadata_filename, FileTest.EXISTS)) {
+			var metadata_parser = new MetadataParser ();
+			var metadata_file = new SourceFile (context, current_source_file.file_type, metadata_filename);
+			context.add_source_file (metadata_file);
+			metadata = metadata_parser.parse_metadata (metadata_file);
+			metadata_roots.add (metadata);
+		}
+
 		var ns_metadata = metadata.match_child (gir_namespace);
 		if (ns_metadata.has_argument (ArgumentType.NAME)) {
 			vala_namespace = ns_metadata.get_string (ArgumentType.NAME);
diff --git a/vapi/metadata/Gedit-3.0.metadata b/vapi/metadata/Gedit-3.0.metadata
index bf2cd5b..b46b2eb 100644
--- a/vapi/metadata/Gedit-3.0.metadata
+++ b/vapi/metadata/Gedit-3.0.metadata
@@ -10,7 +10,6 @@ Encoding  cheader_filename="gedit/gedit-encodings.h"
 EncodingsComboBox cheader_filename="gedit/gedit-encodings-combo-box.h"
 Message cheader_filename="gedit/gedit-message.h"
 MessageBus cheader_filename="gedit/gedit-message-bus.h"
-MessageType cheader_filename="gedit/gedit-message-type.h"
 // present in the gir but the header is missing
 NotebookShowTabsModeType skip=true
 Panel cheader_filename="gedit/gedit-panel.h"
@@ -35,4 +34,3 @@ METADATA_* cheader_filename="gedit/gedit-document.h"
 
 MessageBusForeach cheader_filename="gedit/gedit-message-bus.h"
 MessageCallback cheader_filename="gedit/gedit-message-bus.h"
-MessageTypeForeach cheader_filename="gedit/gedit-message-type.h"
diff --git a/vapi/metadata/Rest-0.7.metadata b/vapi/metadata/Rest-0.7.metadata
index 8d8ce98..db7a1fb 100644
--- a/vapi/metadata/Rest-0.7.metadata
+++ b/vapi/metadata/Rest-0.7.metadata
@@ -4,7 +4,7 @@ OAuthSignatureMethod cheader_filename="rest/oauth-proxy.h"
 OAuth2Proxy cheader_filename="rest/oauth2-proxy.h" cprefix="oauth2_proxy_"
 OAuth2ProxyCall cheader_filename="rest/oauth2-proxy-call.h" cprefix="oauth2_proxy_call_"
 Proxy cheader_filename="rest/rest-proxy.h"
-	.new_call skip=false owned=true
+	.new_call skip=false
 	.bind skip=false
 ProxyCall cheader_filename="rest/rest-proxy-call.h"
 	.run.loop out=true default=null
@@ -21,7 +21,7 @@ ProxyError cheader_filename="rest/rest-proxy.h"
 ProxyCallError cheader_filename="rest/rest-proxy-call.h"
 Param cheader_filename="rest/rest-param.h"
 Params cheader_filename="rest/rest-params.h"
-	.as_string_hash_table skip=false owned=true type_arguments="string,string"
+	.as_string_hash_table skip=false type_arguments="string,string"
 ParamsIter cheader_filename="rest/rest-params.h"
 XmlNode cheader_filename="rest/rest-xml-node.h"
 XmlParser cheader_filename="rest/rest-xml-parser.h"



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