[vala/0.40] parser: Use comment which was already retrieved in parse_declaration()
- From: Rico Tzschichholz <ricotz src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [vala/0.40] parser: Use comment which was already retrieved in parse_declaration()
- Date: Thu, 6 Dec 2018 13:12:20 +0000 (UTC)
commit 990e117be255bec9631a239b9f8d3985e9e83e77
Author: Rico Tzschichholz <ricotz ubuntu com>
Date: Tue Nov 20 12:31:52 2018 +0100
parser: Use comment which was already retrieved in parse_declaration()
This caused to loose comment of first element of enums and error domains.
Regression of 540aa1492c342f482be6838b97f54437f3b776e4
vala/valaparser.vala | 11 +++++++++--
1 file changed, 9 insertions(+), 2 deletions(-)
---
diff --git a/vala/valaparser.vala b/vala/valaparser.vala
index 8446637ca..44936e0b2 100644
--- a/vala/valaparser.vala
+++ b/vala/valaparser.vala
@@ -3102,7 +3102,9 @@ public class Vala.Parser : CodeVisitor {
var value_attrs = parse_attributes ();
var value_begin = get_location ();
string id = parse_identifier ();
- comment = scanner.pop_comment ();
+ if (comment == null) {
+ comment = scanner.pop_comment ();
+ }
Expression value = null;
if (accept (TokenType.ASSIGN)) {
@@ -3113,6 +3115,7 @@ public class Vala.Parser : CodeVisitor {
ev.access = SymbolAccessibility.PUBLIC;
set_attributes (ev, value_attrs);
en.add_value (ev);
+ comment = null;
} while (accept (TokenType.COMMA));
if (accept (TokenType.SEMICOLON)) {
// enum methods
@@ -3166,13 +3169,17 @@ public class Vala.Parser : CodeVisitor {
var code_attrs = parse_attributes ();
var code_begin = get_location ();
string id = parse_identifier ();
- comment = scanner.pop_comment ();
+ if (comment == null) {
+ comment = scanner.pop_comment ();
+ }
+
var ec = new ErrorCode (id, get_src (code_begin), comment);
set_attributes (ec, code_attrs);
if (accept (TokenType.ASSIGN)) {
ec.value = parse_expression ();
}
ed.add_code (ec);
+ comment = null;
} while (accept (TokenType.COMMA));
if (accept (TokenType.SEMICOLON)) {
// errordomain methods
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]