[vala] Fix source reference of switch sections
- From: JÃrg Billeter <juergbi src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [vala] Fix source reference of switch sections
- Date: Tue, 13 Nov 2012 20:26:28 +0000 (UTC)
commit f07829f61213513d2800fe943c36f566da65452d
Author: JÃrg Billeter <j bitron ch>
Date: Tue Nov 13 21:10:07 2012 +0100
Fix source reference of switch sections
vala/valaparser.vala | 1 +
vala/valaswitchsection.vala | 4 ++++
2 files changed, 5 insertions(+), 0 deletions(-)
---
diff --git a/vala/valaparser.vala b/vala/valaparser.vala
index c2e6280..9f090f3 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 ce81805..bf9932f 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;
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]