All pastes #935063 Raw Edit

Someone

public c v1 · immutable
·published 2008-03-09 10:07 UTC
rendered paste body
diff --git a/vala/valaenum.vala b/vala/valaenum.valaindex fc1ca1c..8b98806 100644--- a/vala/valaenum.vala+++ b/vala/valaenum.vala@@ -33,6 +33,9 @@ public class Vala.Enum : Typesymbol { 	public bool is_flags { get; set; }  	public bool has_type_id {+		set construct {+			_has_type_id = value;+		} 		get { 			return _has_type_id; 		}@@ -44,7 +47,7 @@ public class Vala.Enum : Typesymbol { 	private string cprefix; 	private string lower_case_cprefix; 	private string lower_case_csuffix;-	private bool _has_type_id = true;+	private bool _has_type_id; 	private string type_id;  	/**@@ -54,7 +57,7 @@ public class Vala.Enum : Typesymbol { 	 * @param source_reference reference to source code 	 * @return                 newly created enum 	 */-	public Enum (construct string! name, construct SourceReference source_reference = null) {+	public Enum (construct string! name, construct SourceReference source_reference = null, construct bool has_type_id = true) { 	} 	 	/**@@ -220,6 +223,10 @@ public class Vala.Enum : Typesymbol { 		} 	} +	public void set_type_id (string! type_id) {+		this.type_id = type_id;+	}+ 	public override string get_type_id () { 		if (type_id == null) { 			if (_has_type_id) {diff --git a/vala/valainterfacewriter.vala b/vala/valainterfacewriter.valaindex 10c8e93..6cc6a7a 100644--- a/vala/valainterfacewriter.vala+++ b/vala/valainterfacewriter.vala@@ -306,7 +306,12 @@ public class Vala.InterfaceWriter : CodeVisitor { 				cheaders = "%s,%s".printf (cheaders, cheader); 			} 		}-		write_string ("[CCode (cprefix = \"%s\", cheader_filename = \"%s\")]".printf (en.get_cprefix (), cheaders));++		write_string ("[CCode (cprefix = \"%s\", ".printf (en.get_cprefix ()));++		write_string ("has_type_id = \"%d\", ".printf (en.has_type_id));++		write_string ("cheader_filename = \"%s\")]".printf (cheaders));  		if (en.is_flags) { 			write_indent ();diff --git a/vapigen/valagidlparser.vala b/vapigen/valagidlparser.valaindex 2d8404b..7d369bd 100644--- a/vapigen/valagidlparser.vala+++ b/vapigen/valagidlparser.vala@@ -712,14 +712,20 @@ public class Vala.GIdlParser : CodeVisitor { 	 	private Typesymbol parse_enum (IdlNodeEnum! en_node) { 		weak IdlNode node = (IdlNode) en_node;-	+		bool has_type = false;+ 		if (en_node.deprecated) { 			return null; 		} -		var en = new Enum (node.name, current_source_reference);+		if (en_node.gtype_name != null && en_node.gtype_name != "") {+			has_type = true;+		}++		var en = new Enum (node.name, current_source_reference, has_type); 		en.access = SymbolAccessibility.PUBLIC; 		+ 		string common_prefix = null; 		 		foreach (weak IdlNode value in en_node.values) {