summaryrefslogtreecommitdiff
path: root/vala/valaconstant.vala
diff options
context:
space:
mode:
authorJürg Billeter <j@bitron.ch>2010-07-25 20:12:03 +0200
committerJürg Billeter <j@bitron.ch>2010-07-27 15:43:33 +0200
commitc866eed90e47fd0fceaae686497f5939ccc32fae (patch)
tree9c0aa3b3ace401aa2a80f5929a677c7a63bc2176 /vala/valaconstant.vala
parent1f1ecb7a7776f3fd0c5efb7d1635b29f61329b73 (diff)
downloadvala-c866eed90e47fd0fceaae686497f5939ccc32fae.tar.gz
Derive EnumValue from Constant
Diffstat (limited to 'vala/valaconstant.vala')
-rw-r--r--vala/valaconstant.vala12
1 files changed, 9 insertions, 3 deletions
diff --git a/vala/valaconstant.vala b/vala/valaconstant.vala
index 223ea45dc..02b815f0c 100644
--- a/vala/valaconstant.vala
+++ b/vala/valaconstant.vala
@@ -67,9 +67,11 @@ public class Vala.Constant : Symbol, Lockable {
* @param source_reference reference to source code
* @return newly created constant
*/
- public Constant (string name, DataType type_reference, Expression? value, SourceReference? source_reference, Comment? comment = null) {
+ public Constant (string name, DataType? type_reference, Expression? value, SourceReference? source_reference, Comment? comment = null) {
base (name, source_reference, comment);
- this.type_reference = type_reference;
+ if (type_reference != null) {
+ this.type_reference = type_reference;
+ }
this.value = value;
}
@@ -103,7 +105,7 @@ public class Vala.Constant : Symbol, Lockable {
*
* @return the name to be used in C code by default
*/
- public string get_default_cname () {
+ public virtual string get_default_cname () {
if (parent_symbol == null) {
// global constant
return name;
@@ -112,6 +114,10 @@ public class Vala.Constant : Symbol, Lockable {
}
}
+ public void set_cname (string value) {
+ this.cname = value;
+ }
+
public bool get_lock_used () {
return lock_used;
}