[vala/0.10] girparser: Report error on unsupported GIR version



commit 1fd20bd2edd5903e04085289397d02daeed556bf
Author: Jürg Billeter <j bitron ch>
Date:   Thu Sep 16 17:39:58 2010 +0200

    girparser: Report error on unsupported GIR version
    
    Fixes bug 629805.

 vala/valagirparser.vala |    6 ++++++
 1 files changed, 6 insertions(+), 0 deletions(-)
---
diff --git a/vala/valagirparser.vala b/vala/valagirparser.vala
index 53cb317..0540388 100644
--- a/vala/valagirparser.vala
+++ b/vala/valagirparser.vala
@@ -131,8 +131,14 @@ public class Vala.GirParser : CodeVisitor {
 		return new SourceReference (this.current_source_file, begin.line, begin.column, end.line, end.column);
 	}
 
+	const string GIR_VERSION = "1.2";
+
 	void parse_repository () {
 		start_element ("repository");
+		if (reader.get_attribute ("version") != GIR_VERSION) {
+			Report.error (get_current_src (), "unsupported GIR version %s (supported: %s)".printf (reader.get_attribute ("version"), GIR_VERSION));
+			return;
+		}
 		next ();
 		while (current_token == MarkupTokenType.START_ELEMENT) {
 			if (reader.name == "namespace") {



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