[vala] Rename Constant.initializer to Constant.value
- From: Jürg Billeter <juergbi src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [vala] Rename Constant.initializer to Constant.value
- Date: Tue, 27 Jul 2010 16:58:57 +0000 (UTC)
commit 1f1ecb7a7776f3fd0c5efb7d1635b29f61329b73
Author: Jürg Billeter <j bitron ch>
Date: Sun Jul 25 11:39:18 2010 +0200
Rename Constant.initializer to Constant.value
codegen/valaccodebasemodule.vala | 6 ++--
codegen/valadovabasemodule.vala | 6 ++--
codegen/valagirwriter.vala | 2 +-
vala/valaconstant.vala | 44 +++++++++++++++++++-------------------
4 files changed, 29 insertions(+), 29 deletions(-)
---
diff --git a/codegen/valaccodebasemodule.vala b/codegen/valaccodebasemodule.vala
index 4edeb1a..677f4ff 100644
--- a/codegen/valaccodebasemodule.vala
+++ b/codegen/valaccodebasemodule.vala
@@ -776,7 +776,7 @@ public class Vala.CCodeBaseModule : CCodeModule {
if (!c.external) {
generate_type_declaration (c.type_reference, decl_space);
- var initializer_list = c.initializer as InitializerList;
+ var initializer_list = c.value as InitializerList;
if (initializer_list != null) {
var cdecl = new CCodeDeclaration (c.type_reference.get_const_cname ());
var arr = "";
@@ -784,7 +784,7 @@ public class Vala.CCodeBaseModule : CCodeModule {
arr = "[%d]".printf (initializer_list.size);
}
- var cinitializer = (CCodeExpression) c.initializer.ccodenode;
+ var cinitializer = (CCodeExpression) c.value.ccodenode;
if (!definition) {
// never output value in header
// special case needed as this method combines declaration and definition
@@ -800,7 +800,7 @@ public class Vala.CCodeBaseModule : CCodeModule {
decl_space.add_constant_declaration (cdecl);
} else {
- var cdefine = new CCodeMacroReplacement.with_expression (c.get_cname (), (CCodeExpression) c.initializer.ccodenode);
+ var cdefine = new CCodeMacroReplacement.with_expression (c.get_cname (), (CCodeExpression) c.value.ccodenode);
decl_space.add_type_member_declaration (cdefine);
}
}
diff --git a/codegen/valadovabasemodule.vala b/codegen/valadovabasemodule.vala
index 9f90255..915448f 100644
--- a/codegen/valadovabasemodule.vala
+++ b/codegen/valadovabasemodule.vala
@@ -401,18 +401,18 @@ internal class Vala.DovaBaseModule : CCodeModule {
c.accept_children (codegen);
if (!c.external) {
- if (c.initializer is InitializerList) {
+ if (c.value is InitializerList) {
var cdecl = new CCodeDeclaration (c.type_reference.get_const_cname ());
var arr = "";
if (c.type_reference is ArrayType) {
arr = "[]";
}
- cdecl.add_declarator (new CCodeVariableDeclarator ("%s%s".printf (c.get_cname (), arr), (CCodeExpression) c.initializer.ccodenode));
+ cdecl.add_declarator (new CCodeVariableDeclarator ("%s%s".printf (c.get_cname (), arr), (CCodeExpression) c.value.ccodenode));
cdecl.modifiers = CCodeModifiers.STATIC;
decl_space.add_constant_declaration (cdecl);
} else {
- var cdefine = new CCodeMacroReplacement.with_expression (c.get_cname (), (CCodeExpression) c.initializer.ccodenode);
+ var cdefine = new CCodeMacroReplacement.with_expression (c.get_cname (), (CCodeExpression) c.value.ccodenode);
decl_space.add_type_member_declaration (cdefine);
}
}
diff --git a/codegen/valagirwriter.vala b/codegen/valagirwriter.vala
index b01eb47..601583c 100644
--- a/codegen/valagirwriter.vala
+++ b/codegen/valagirwriter.vala
@@ -487,7 +487,7 @@ public class Vala.GIRWriter : CodeVisitor {
}
//TODO Add better constant evaluation
- var initializer = c.initializer;
+ var initializer = c.value;
string value = literal_expression_to_value_string (initializer);
write_indent ();
diff --git a/vala/valaconstant.vala b/vala/valaconstant.vala
index 416ab22..223ea45 100644
--- a/vala/valaconstant.vala
+++ b/vala/valaconstant.vala
@@ -1,6 +1,6 @@
/* valaconstant.vala
*
- * Copyright (C) 2006-2009 Jürg Billeter
+ * Copyright (C) 2006-2010 Jürg Billeter
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
@@ -40,12 +40,12 @@ public class Vala.Constant : Symbol, Lockable {
/**
* The value of this constant.
*/
- public Expression? initializer {
- get { return _initializer; }
+ public Expression? value {
+ get { return _value; }
set {
- _initializer = value;
- if (_initializer != null) {
- _initializer.parent_node = this;
+ _value = value;
+ if (_value != null) {
+ _value.parent_node = this;
}
}
}
@@ -56,21 +56,21 @@ public class Vala.Constant : Symbol, Lockable {
private DataType _data_type;
- private Expression _initializer;
+ private Expression _value;
/**
* Creates a new constant.
*
* @param name constant name
* @param type_reference constant type
- * @param initializer constant value
+ * @param value constant value
* @param source_reference reference to source code
* @return newly created constant
*/
- public Constant (string name, DataType type_reference, Expression? initializer, 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;
- this.initializer = initializer;
+ this.value = value;
}
public override void accept (CodeVisitor visitor) {
@@ -80,8 +80,8 @@ public class Vala.Constant : Symbol, Lockable {
public override void accept_children (CodeVisitor visitor) {
type_reference.accept (visitor);
- if (initializer != null) {
- initializer.accept (visitor);
+ if (value != null) {
+ value.accept (visitor);
}
}
@@ -121,8 +121,8 @@ public class Vala.Constant : Symbol, Lockable {
}
public override void replace_expression (Expression old_node, Expression new_node) {
- if (initializer == old_node) {
- initializer = new_node;
+ if (value == old_node) {
+ value = new_node;
}
}
@@ -183,24 +183,24 @@ public class Vala.Constant : Symbol, Lockable {
}
if (!external) {
- if (initializer == null) {
+ if (value == null) {
error = true;
- Report.error (source_reference, "A const field requires a initializer to be provided");
+ Report.error (source_reference, "A const field requires a value to be provided");
} else {
- initializer.target_type = type_reference;
+ value.target_type = type_reference;
- initializer.check (analyzer);
+ value.check (analyzer);
- if (!initializer.value_type.compatible (type_reference)) {
+ if (!value.value_type.compatible (type_reference)) {
error = true;
- Report.error (source_reference, "Cannot convert from `%s' to `%s'".printf (initializer.value_type.to_string (), type_reference.to_string ()));
+ Report.error (source_reference, "Cannot convert from `%s' to `%s'".printf (value.value_type.to_string (), type_reference.to_string ()));
return false;
}
}
} else {
- if (initializer != null) {
+ if (value != null) {
error = true;
- Report.error (source_reference, "External constants cannot use initializers");
+ Report.error (source_reference, "External constants cannot use values");
}
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]