From: Jürg Billeter Date: Tue, 13 Nov 2012 20:10:07 +0000 (+0100) Subject: Fix source reference of switch sections X-Git-Tag: 0.19.0~80 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=f07829f61213513d2800fe943c36f566da65452d;p=thirdparty%2Fvala.git Fix source reference of switch sections --- diff --git a/vala/valaparser.vala b/vala/valaparser.vala index c2e62807c..9f090f3ed 100644 --- a/vala/valaparser.vala +++ b/vala/valaparser.vala @@ -1811,6 +1811,7 @@ public class Vala.Parser : CodeVisitor { var stmt = new SwitchStatement (condition, get_src (begin)); expect (TokenType.OPEN_BRACE); while (current () != TokenType.CLOSE_BRACE) { + begin = get_location (); var section = new SwitchSection (get_src (begin)); do { if (accept (TokenType.CASE)) { diff --git a/vala/valaswitchsection.vala b/vala/valaswitchsection.vala index ce8180507..bf9932f04 100644 --- a/vala/valaswitchsection.vala +++ b/vala/valaswitchsection.vala @@ -44,6 +44,10 @@ public class Vala.SwitchSection : Block { * @param label a switch label */ public void add_label (SwitchLabel label) { + if (labels.size == 0) { + this.source_reference = label.source_reference; + } + labels.add (label); label.section = this; }