[vala] Move EnumValue.get_canonical_cconstant to the codegen
- From: Luca Bruno <lucabru src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [vala] Move EnumValue.get_canonical_cconstant to the codegen
- Date: Thu, 4 Aug 2011 07:54:28 +0000 (UTC)
commit 5a4cf3022f57292becf5b5b2c2e71e019914a47e
Author: Luca Bruno <lucabru src gnome org>
Date: Wed Aug 3 22:02:12 2011 +0200
Move EnumValue.get_canonical_cconstant to the codegen
codegen/valaccodebasemodule.vala | 21 +++++++++++++++++++++
codegen/valatyperegisterfunction.vala | 2 +-
vala/valaenumvalue.vala | 27 ---------------------------
3 files changed, 22 insertions(+), 28 deletions(-)
---
diff --git a/codegen/valaccodebasemodule.vala b/codegen/valaccodebasemodule.vala
index e5c11b1..5ed6f85 100644
--- a/codegen/valaccodebasemodule.vala
+++ b/codegen/valaccodebasemodule.vala
@@ -5840,6 +5840,27 @@ public abstract class Vala.CCodeBaseModule : CodeGenerator {
return new CCodeConstant (str.str);
}
+ public static CCodeConstant get_enum_value_canonical_cconstant (EnumValue ev) {
+ var str = new StringBuilder ("\"");
+
+ string i = ev.name;
+
+ while (i.length > 0) {
+ unichar c = i.get_char ();
+ if (c == '_') {
+ str.append_c ('-');
+ } else {
+ str.append_unichar (c.tolower ());
+ }
+
+ i = i.next_char ();
+ }
+
+ str.append_c ('"');
+
+ return new CCodeConstant (str.str);
+ }
+
public bool get_signal_has_emitter (Signal sig) {
return sig.get_attribute ("HasEmitter") != null;
}
diff --git a/codegen/valatyperegisterfunction.vala b/codegen/valatyperegisterfunction.vala
index a226683..61e77a8 100644
--- a/codegen/valatyperegisterfunction.vala
+++ b/codegen/valatyperegisterfunction.vala
@@ -173,7 +173,7 @@ public abstract class Vala.TypeRegisterFunction {
clist_ev = new CCodeInitializerList ();
clist_ev.append (new CCodeConstant (CCodeBaseModule.get_ccode_name (ev)));
clist_ev.append (new CCodeIdentifier ("\"%s\"".printf (CCodeBaseModule.get_ccode_name (ev))));
- clist_ev.append (ev.get_canonical_cconstant ());
+ clist_ev.append (CCodeBaseModule.get_enum_value_canonical_cconstant (ev));
clist.append (clist_ev);
}
diff --git a/vala/valaenumvalue.vala b/vala/valaenumvalue.vala
index 05d4494..b4d27bf 100644
--- a/vala/valaenumvalue.vala
+++ b/vala/valaenumvalue.vala
@@ -37,33 +37,6 @@ public class Vala.EnumValue : Constant {
base (name, null, value, source_reference, comment);
}
- /**
- * Returns the string literal of this signal to be used in C code.
- * (FIXME: from vlaasignal.vala)
- *
- * @return string literal to be used in C code
- */
- public CCodeConstant get_canonical_cconstant () {
- var str = new StringBuilder ("\"");
-
- string i = name;
-
- while (i.length > 0) {
- unichar c = i.get_char ();
- if (c == '_') {
- str.append_c ('-');
- } else {
- str.append_unichar (c.tolower ());
- }
-
- i = i.next_char ();
- }
-
- str.append_c ('"');
-
- return new CCodeConstant (str.str);
- }
-
public override void accept (CodeVisitor visitor) {
visitor.visit_enum_value (this);
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]