[vala/0.46] girparser: Actually respect given cprefix metadata for enumerations
- From: Rico Tzschichholz <ricotz src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [vala/0.46] girparser: Actually respect given cprefix metadata for enumerations
- Date: Mon, 22 Jun 2020 09:07:11 +0000 (UTC)
commit 6a177a6731e4a0fca089e10c5bc82af28db23b7f
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 c31c8a344..541ddbeac 100644
--- a/vala/valagirparser.vala
+++ b/vala/valagirparser.vala
@@ -2373,7 +2373,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 ();
@@ -2390,9 +2395,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]