[vala/staging: 2/2] codegen: Fix get_ccode_name() for properties
- From: Rico Tzschichholz <ricotz src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [vala/staging: 2/2] codegen: Fix get_ccode_name() for properties
- Date: Sun, 16 Sep 2018 15:25:16 +0000 (UTC)
commit 37abce26de0134f25b5c42d1de00153604c9b081
Author: Rico Tzschichholz <ricotz ubuntu com>
Date: Tue Jun 12 15:40:01 2018 +0200
codegen: Fix get_ccode_name() for properties
codegen/valaccodeattribute.vala | 2 ++
codegen/valaccodebasemodule.vala | 2 +-
codegen/valagirwriter.vala | 2 +-
3 files changed, 4 insertions(+), 2 deletions(-)
---
diff --git a/codegen/valaccodeattribute.vala b/codegen/valaccodeattribute.vala
index b6f60498c..ba54c659f 100644
--- a/codegen/valaccodeattribute.vala
+++ b/codegen/valaccodeattribute.vala
@@ -686,6 +686,8 @@ public class Vala.CCodeAttribute : AttributeCache {
} else {
return "%s%s".printf (get_ccode_lower_case_prefix
(sym.parent_symbol), sym.name);
}
+ } else if (sym is Property) {
+ return sym.name.replace ("_", "-");
} else if (sym is PropertyAccessor) {
unowned PropertyAccessor acc = (PropertyAccessor) sym;
var t = (TypeSymbol) acc.prop.parent_symbol;
diff --git a/codegen/valaccodebasemodule.vala b/codegen/valaccodebasemodule.vala
index 2da65098a..3021f0971 100644
--- a/codegen/valaccodebasemodule.vala
+++ b/codegen/valaccodebasemodule.vala
@@ -6333,7 +6333,7 @@ public abstract class Vala.CCodeBaseModule : CodeGenerator {
}
public CCodeConstant get_property_canonical_cconstant (Property prop) {
- return new CCodeConstant ("\"%s\"".printf (prop.name.replace ("_", "-")));
+ return new CCodeConstant ("\"%s\"".printf (get_ccode_name (prop)));
}
public override void visit_class (Class cl) {
diff --git a/codegen/valagirwriter.vala b/codegen/valagirwriter.vala
index 7c2ebc7f0..12b87ece8 100644
--- a/codegen/valagirwriter.vala
+++ b/codegen/valagirwriter.vala
@@ -1133,7 +1133,7 @@ public class Vala.GIRWriter : CodeVisitor {
}
write_indent ();
- buffer.append_printf ("<property name=\"%s\"", prop.name.replace ("_", "-"));
+ buffer.append_printf ("<property name=\"%s\"", get_ccode_name (prop));
if (prop.get_accessor == null) {
buffer.append_printf (" readable=\"0\"");
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]