[vala/staging] girparser: Actually respect given cprefix metadata for enumerations
- From: Rico Tzschichholz <ricotz src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [vala/staging] girparser: Actually respect given cprefix metadata for enumerations
- Date: Wed, 17 Jun 2020 16:07:45 +0000 (UTC)
commit 893033e08b1c01ae771099f6ef2066b88ffb8097
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 33d005a41..3b0743f24 100644
--- a/vala/valagirparser.vala
+++ b/vala/valagirparser.vala
@@ -2386,7 +2386,12 @@ public class Vala.GirParser : CodeVisitor {
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 ();
@@ -2403,9 +2408,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]