diff options
author | Rico Tzschichholz <ricotz@ubuntu.com> | 2019-03-08 18:46:02 +0100 |
---|---|---|
committer | Rico Tzschichholz <ricotz@ubuntu.com> | 2019-03-08 18:46:02 +0100 |
commit | 389755543d10c3ae5ffc8786fbf5f06ee5ce7f15 (patch) | |
tree | ee62fa6e94a9598e193c0fd0b850d2e1a92fe111 /vala | |
parent | 40fa34979a4f4fd056bc05f8af0cb7b511205c11 (diff) | |
download | vala-389755543d10c3ae5ffc8786fbf5f06ee5ce7f15.tar.gz |
parser: Don't include assigned value in source_reference of constants
This is how it is done for fields already.
Diffstat (limited to 'vala')
-rw-r--r-- | vala/valaparser.vala | 13 |
1 files changed, 6 insertions, 7 deletions
diff --git a/vala/valaparser.vala b/vala/valaparser.vala index 236ab4947..1a1320bb1 100644 --- a/vala/valaparser.vala +++ b/vala/valaparser.vala @@ -2587,19 +2587,13 @@ public class Vala.Parser : CodeVisitor { type = parse_inline_array_type (type); - Expression initializer = null; - if (accept (TokenType.ASSIGN)) { - initializer = parse_expression (); - } - expect (TokenType.SEMICOLON); - // constant arrays don't own their element var array_type = type as ArrayType; if (array_type != null) { array_type.element_type.value_owned = false; } - var c = new Constant (id, type, initializer, get_src (begin), comment); + var c = new Constant (id, type, null, get_src (begin), comment); c.access = access; if (ModifierFlags.EXTERN in flags || scanner.source_file.file_type == SourceFileType.PACKAGE) { c.external = true; @@ -2613,6 +2607,11 @@ public class Vala.Parser : CodeVisitor { Report.warning (c.source_reference, "the modifier `static' is not applicable to constants"); } + if (accept (TokenType.ASSIGN)) { + c.value = parse_expression (); + } + expect (TokenType.SEMICOLON); + parent.add_constant (c); } |