[vala/switch-to-gir] girparser: Move metadata loading into parse_file



commit 2312953b8e8018e0ccbad9adb20a0e71a06889e1
Author: Luca Bruno <lethalman88 gmail com>
Date:   Wed Aug 25 21:54:11 2010 +0200

    girparser: Move metadata loading into parse_file

 vala/valagirparser.vala |   25 +++++++++++++------------
 1 files changed, 13 insertions(+), 12 deletions(-)
---
diff --git a/vala/valagirparser.vala b/vala/valagirparser.vala
index c9c72b5..9beb789 100644
--- a/vala/valagirparser.vala
+++ b/vala/valagirparser.vala
@@ -552,24 +552,23 @@ public class Vala.GirParser : CodeVisitor {
 		}
 
 		if (source_file.filename.has_suffix (".gir")) {
-			metadata_stack = new ArrayList<Metadata> ();
-			metadata = Metadata.empty;
-
-			string metadata_filename = "%s.metadata".printf (source_file.filename.ndup (source_file.filename.length - ".gir".length));
-			if (FileUtils.test (metadata_filename, FileTest.EXISTS)) {
-				var metadata_parser = new MetadataParser ();
-				metadata_stack.add (metadata);
-				metadata = metadata_parser.parse_metadata (new SourceFile (context, metadata_filename, true));
-			}
-
 			parse_file (source_file);
-
-			report_unused_metadata (metadata);
 		}
 	}
 
 	public void parse_file (SourceFile source_file) {
 		this.current_source_file = source_file;
+
+		// load metadata
+		metadata_stack = new ArrayList<Metadata> ();
+		metadata = Metadata.empty;
+		string metadata_filename = "%s.metadata".printf (source_file.filename.ndup (source_file.filename.length - ".gir".length));
+		if (FileUtils.test (metadata_filename, FileTest.EXISTS)) {
+			var metadata_parser = new MetadataParser ();
+			metadata_stack.add (metadata);
+			metadata = metadata_parser.parse_metadata (new SourceFile (context, metadata_filename, true));
+		}
+
 		reader = new MarkupReader (source_file.filename);
 
 		// xml prolog
@@ -579,6 +578,8 @@ public class Vala.GirParser : CodeVisitor {
 		next ();
 		parse_repository ();
 
+		report_unused_metadata (metadata);
+
 		reader = null;
 		this.current_source_file = null;
 	}



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