[vala/0.40] girparser: Actually respect given cprefix metadata for enumerations
- From: Rico Tzschichholz <ricotz src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [vala/0.40] girparser: Actually respect given cprefix metadata for enumerations
- Date: Mon, 22 Jun 2020 09:06:50 +0000 (UTC)
commit 5575ab01eeaa66b81fe60db949bfe1d79d830b58
Author: Rico Tzschichholz <ricotz ubuntu com>
Date: Wed Jun 17 16:58:56 2020 +0200
girparser: Actually respect given cprefix metadata for enumerations
vala/valagirparser.vala | 10 ++++++++--
1 file changed, 8 insertions(+), 2 deletions(-)
---
diff --git a/vala/valagirparser.vala b/vala/valagirparser.vala
index 1994e4853..a9f7a4ac7 100644
--- a/vala/valagirparser.vala
+++ b/vala/valagirparser.vala
@@ -2374,7 +2374,12 @@ public class Vala.GirParser : CodeVisitor {
sym.external = true;
sym.access = SymbolAccessibility.PUBLIC;
- string common_prefix = null;
+ string? common_prefix = null;
+ bool explicit_prefix = false;
+ if (metadata.has_argument (ArgumentType.CPREFIX)) {
+ sym.set_attribute_string ("CCode", "cprefix", metadata.get_string
(ArgumentType.CPREFIX));
+ explicit_prefix = true;
+ }
bool has_member = false;
next ();
@@ -2391,9 +2396,10 @@ public class Vala.GirParser : CodeVisitor {
has_member = true;
if (error_domain) {
parse_error_member ();
- calculate_common_prefix (ref common_prefix, old_current.get_cname ());
} else {
parse_enumeration_member ();
+ }
+ if (!explicit_prefix) {
calculate_common_prefix (ref common_prefix, old_current.get_cname ());
}
} else if (reader.name == "function") {
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]