]> git.ipfire.org Git - thirdparty/vala.git/commitdiff
Set source_reference for error codes
authorJürg Billeter <j@bitron.ch>
Tue, 1 Jul 2008 11:33:22 +0000 (11:33 +0000)
committerJürg Billeter <juergbi@src.gnome.org>
Tue, 1 Jul 2008 11:33:22 +0000 (11:33 +0000)
2008-07-01  Jürg Billeter  <j@bitron.ch>

* vala/valaerrorcode.vala:
* vala/valaparser.vala:

Set source_reference for error codes

svn path=/trunk/; revision=1668

ChangeLog
vala/valaerrorcode.vala
vala/valaparser.vala

index 2a2497a91f0202b19e064fbda2d8c6ba21947a08..dd1ad809a9c3af055111a4c181f03f7a3c7b8ece 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,10 @@
+2008-07-01  Jürg Billeter  <j@bitron.ch>
+
+       * vala/valaerrorcode.vala:
+       * vala/valaparser.vala:
+
+       Set source_reference for error codes
+
 2008-07-01  Jared Moore  <jaredm@svn.gnome.org>
 
        * vapi/gtk+-2.0.vapi: Regenerated to make consistent with recent
index 18795db3f55cbb103fe96b81218dd178b11084d6..c872c83a4ead48c715568c204e41d3c1d84697cb 100644 (file)
@@ -39,8 +39,9 @@ public class Vala.ErrorCode : Symbol {
         * @param name enum value name
         * @return     newly created enum value
         */
-       public ErrorCode (string name) {
+       public ErrorCode (string name, SourceReference? source_reference = null) {
                this.name = name;
+               this.source_reference = source_reference;
        }
 
        /**
@@ -50,9 +51,10 @@ public class Vala.ErrorCode : Symbol {
         * @param value numerical representation
         * @return      newly created enum value
         */
-       public ErrorCode.with_value (string name, Expression value) {
+       public ErrorCode.with_value (string name, Expression value, SourceReference? source_reference = null) {
                this.name = name;
                this.value = value;
+               this.source_reference = source_reference;
        }
        
        public override void accept (CodeVisitor visitor) {
index 25c0a5bcb8a412b0d13297f3bc2b32b048e03475..1e4e5ebc507baa3d2ef75c6da84bffe5c398fc60 100644 (file)
@@ -2489,8 +2489,9 @@ public class Vala.Parser : CodeVisitor {
                                break;
                        }
                        var code_attrs = parse_attributes ();
+                       var code_begin = get_location ();
                        string id = parse_identifier ();
-                       var ec = new ErrorCode (id);
+                       var ec = new ErrorCode (id, get_src (code_begin));
                        set_attributes (ec, code_attrs);
                        if (accept (TokenType.ASSIGN)) {
                                ec.value = parse_expression ();