summaryrefslogtreecommitdiff
path: root/vala/valaconstant.vala
diff options
context:
space:
mode:
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;
}