From: Rico Tzschichholz Date: Tue, 20 Nov 2018 11:31:52 +0000 (+0100) Subject: parser: Use comment which was already retrieved in parse_declaration() X-Git-Tag: 0.43.1~74 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=8bbc99bea1b14977d7a570149911b09c0e2d5c0d;p=thirdparty%2Fvala.git 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 --- diff --git a/vala/valaparser.vala b/vala/valaparser.vala index f52fba893..032e2638b 100644 --- a/vala/valaparser.vala +++ b/vala/valaparser.vala @@ -3073,7 +3073,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)) { @@ -3084,6 +3086,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 @@ -3137,13 +3140,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