[vala/0.42] parser: Don't include assigned value in source_reference of constants
- From: Rico Tzschichholz <ricotz src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [vala/0.42] parser: Don't include assigned value in source_reference of constants
- Date: Wed, 10 Apr 2019 14:27:05 +0000 (UTC)
commit 4be99c8af5f474baf90a0e7a4c5f00e4b517cd71
Author: Rico Tzschichholz <ricotz ubuntu com>
Date: Fri Mar 8 18:46:02 2019 +0100
parser: Don't include assigned value in source_reference of constants
This is how it is done for fields already.
vala/valaparser.vala | 13 ++++++-------
1 file changed, 6 insertions(+), 7 deletions(-)
---
diff --git a/vala/valaparser.vala b/vala/valaparser.vala
index 239de6bc1..42c300828 100644
--- a/vala/valaparser.vala
+++ b/vala/valaparser.vala
@@ -2604,19 +2604,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;
@@ -2630,6 +2624,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);
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]