vala r1389 - in trunk: . gobject vala
- From: juergbi svn gnome org
- To: svn-commits-list gnome org
- Subject: vala r1389 - in trunk: . gobject vala
- Date: Tue, 13 May 2008 10:05:33 +0100 (BST)
Author: juergbi
Date: Tue May 13 09:05:32 2008
New Revision: 1389
URL: http://svn.gnome.org/viewvc/vala?rev=1389&view=rev
Log:
2008-05-13 Juerg Billeter <j bitron ch>
* vala/valaclass.vala:
* vala/valainterfacewriter.vala:
* vala/valamemorymanager.vala:
* vala/valaproperty.vala:
* vala/valasemanticanalyzer.vala:
* gobject/valaccodeassignmentbinding.vala:
* gobject/valaccodeclassbinding.vala:
* gobject/valaccodegenerator.vala:
* gobject/valaccodememberaccessbinding.vala:
* gobject/valaccodetypesymbolbinding.vala:
* gobject/valagidlwriter.vala:
Rename Property.type_reference to Property.property_type
Modified:
trunk/ChangeLog
trunk/gobject/valaccodeassignmentbinding.vala
trunk/gobject/valaccodeclassbinding.vala
trunk/gobject/valaccodegenerator.vala
trunk/gobject/valaccodememberaccessbinding.vala
trunk/gobject/valaccodetypesymbolbinding.vala
trunk/gobject/valagidlwriter.vala
trunk/vala/valaclass.vala
trunk/vala/valainterfacewriter.vala
trunk/vala/valamemorymanager.vala
trunk/vala/valaproperty.vala
trunk/vala/valasemanticanalyzer.vala
Modified: trunk/gobject/valaccodeassignmentbinding.vala
==============================================================================
--- trunk/gobject/valaccodeassignmentbinding.vala (original)
+++ trunk/gobject/valaccodeassignmentbinding.vala Tue May 13 09:05:32 2008
@@ -41,15 +41,15 @@
var prop = (Property) assignment.left.symbol_reference;
if (prop.set_accessor.construction && codegen.current_type_symbol is Class && codegen.current_class.is_subtype_of (codegen.gobject_type) && codegen.in_creation_method) {
- codenode = get_construct_property_assignment (prop.get_canonical_cconstant (), prop.type_reference, (CCodeExpression) assignment.right.ccodenode);
+ codenode = get_construct_property_assignment (prop.get_canonical_cconstant (), prop.property_type, (CCodeExpression) assignment.right.ccodenode);
} else {
CCodeExpression cexpr = (CCodeExpression) assignment.right.ccodenode;
// ensure to pass the value correctly typed (especially important for varargs)
- cexpr = codegen.get_implicit_cast_expression (cexpr, assignment.right.value_type, prop.type_reference);
+ cexpr = codegen.get_implicit_cast_expression (cexpr, assignment.right.value_type, prop.property_type);
if (!prop.no_accessor_method) {
- if (prop.type_reference.is_real_struct_type ()) {
+ if (prop.property_type.is_real_struct_type ()) {
cexpr = codegen.get_address_of_expression (assignment.right, cexpr);
}
}
Modified: trunk/gobject/valaccodeclassbinding.vala
==============================================================================
--- trunk/gobject/valaccodeclassbinding.vala (original)
+++ trunk/gobject/valaccodeclassbinding.vala Tue May 13 09:05:32 2008
@@ -419,7 +419,7 @@
var props = cl.get_properties ();
foreach (Property prop in props) {
// FIXME: omit real struct types for now since they cannot be expressed as gobject property yet
- if (prop.type_reference.is_real_struct_type ()) {
+ if (prop.property_type.is_real_struct_type ()) {
continue;
}
if (prop.access == SymbolAccessibility.PRIVATE) {
@@ -601,7 +601,7 @@
var props = cl.get_properties ();
foreach (Property prop in props) {
// FIXME: omit real struct types for now since they cannot be expressed as gobject property yet
- if (prop.get_accessor == null || prop.is_abstract || prop.type_reference.is_real_struct_type ()) {
+ if (prop.get_accessor == null || prop.is_abstract || prop.property_type.is_real_struct_type ()) {
continue;
}
if (prop.access == SymbolAccessibility.PRIVATE) {
@@ -620,7 +620,7 @@
var ccall = new CCodeFunctionCall (new CCodeIdentifier ("%s_get_%s".printf (prefix, prop.name)));
ccall.add_argument (new CCodeIdentifier ("self"));
var csetcall = new CCodeFunctionCall ();
- csetcall.call = get_value_setter_function (prop.type_reference);
+ csetcall.call = get_value_setter_function (prop.property_type);
csetcall.add_argument (new CCodeIdentifier ("value"));
csetcall.add_argument (ccall);
ccase.add_statement (new CCodeExpressionStatement (csetcall));
@@ -656,7 +656,7 @@
var props = cl.get_properties ();
foreach (Property prop in props) {
// FIXME: omit real struct types for now since they cannot be expressed as gobject property yet
- if (prop.set_accessor == null || prop.is_abstract || prop.type_reference.is_real_struct_type ()) {
+ if (prop.set_accessor == null || prop.is_abstract || prop.property_type.is_real_struct_type ()) {
continue;
}
if (prop.access == SymbolAccessibility.PRIVATE) {
@@ -675,8 +675,8 @@
var ccall = new CCodeFunctionCall (new CCodeIdentifier ("%s_set_%s".printf (prefix, prop.name)));
ccall.add_argument (new CCodeIdentifier ("self"));
var cgetcall = new CCodeFunctionCall ();
- if (prop.type_reference.data_type != null) {
- cgetcall.call = new CCodeIdentifier (prop.type_reference.data_type.get_get_value_function ());
+ if (prop.property_type.data_type != null) {
+ cgetcall.call = new CCodeIdentifier (prop.property_type.data_type.get_get_value_function ());
} else {
cgetcall.call = new CCodeIdentifier ("g_value_get_pointer");
}
Modified: trunk/gobject/valaccodegenerator.vala
==============================================================================
--- trunk/gobject/valaccodegenerator.vala (original)
+++ trunk/gobject/valaccodegenerator.vala Tue May 13 09:05:32 2008
@@ -746,7 +746,7 @@
// FIXME: omit real struct types for now since they cannot be expressed as gobject property yet
// don't register private properties
- if (prop.parent_symbol is Class && !prop.type_reference.is_real_struct_type () && prop.access != SymbolAccessibility.PRIVATE) {
+ if (prop.parent_symbol is Class && !prop.property_type.is_real_struct_type () && prop.access != SymbolAccessibility.PRIVATE) {
prop_enum.add_value (new CCodeEnumValue (prop.get_upper_case_cname ()));
}
}
@@ -757,10 +757,10 @@
var prop = (Property) acc.prop;
- bool returns_real_struct = prop.type_reference.is_real_struct_type ();
+ bool returns_real_struct = prop.property_type.is_real_struct_type ();
if (acc.readable && !returns_real_struct) {
- current_return_type = prop.type_reference;
+ current_return_type = prop.property_type;
} else {
current_return_type = new VoidType ();
}
@@ -778,13 +778,13 @@
this_type = new InterfaceInstanceType ((Interface) t);
}
var cselfparam = new CCodeFormalParameter ("self", this_type.get_cname ());
- var value_type = prop.type_reference.copy ();
+ var value_type = prop.property_type.copy ();
value_type.takes_ownership = value_type.transfers_ownership;
var cvalueparam = new CCodeFormalParameter ("value", value_type.get_cname ());
if (prop.is_abstract || prop.is_virtual) {
if (acc.readable) {
- function = new CCodeFunction ("%s_get_%s".printf (t.get_lower_case_cname (null), prop.name), prop.type_reference.get_cname ());
+ function = new CCodeFunction ("%s_get_%s".printf (t.get_lower_case_cname (null), prop.name), prop.property_type.get_cname ());
} else {
function = new CCodeFunction ("%s_set_%s".printf (t.get_lower_case_cname (null), prop.name), "void");
}
@@ -806,7 +806,7 @@
if (acc.readable) {
// declare temporary variable to save the property value
- var decl = new CCodeDeclaration (prop.type_reference.get_cname ());
+ var decl = new CCodeDeclaration (prop.property_type.get_cname ());
decl.add_declarator (new CCodeVariableDeclarator ("value"));
block.add_statement (decl);
@@ -826,9 +826,9 @@
block.add_statement (new CCodeExpressionStatement (ccall));
// HACK: decrement the refcount before returning the value to simulate a weak reference getter function
- if (prop.type_reference.data_type != null && prop.type_reference.data_type.is_reference_counting ()) {
+ if (prop.property_type.data_type != null && prop.property_type.data_type.is_reference_counting ()) {
var unref_cond = new CCodeBinaryExpression (CCodeBinaryOperator.INEQUALITY, new CCodeIdentifier ("value"), new CCodeConstant ("NULL"));
- var unref_function = new CCodeFunctionCall (get_destroy_func_expression (prop.type_reference));
+ var unref_function = new CCodeFunctionCall (get_destroy_func_expression (prop.property_type));
unref_function.add_argument (new CCodeIdentifier ("value"));
var unref_block = new CCodeBlock ();
unref_block.add_statement (new CCodeExpressionStatement (unref_function));
@@ -868,7 +868,7 @@
// return non simple structs as out parameter
function = new CCodeFunction ("%s_get_%s".printf (prefix, prop.name), "void");
} else {
- function = new CCodeFunction ("%s_get_%s".printf (prefix, prop.name), prop.type_reference.get_cname ());
+ function = new CCodeFunction ("%s_get_%s".printf (prefix, prop.name), prop.property_type.get_cname ());
}
} else {
function = new CCodeFunction ("%s_set_%s".printf (prefix, prop.name), "void");
@@ -879,7 +879,7 @@
function.add_parameter (cselfparam);
if (returns_real_struct) {
// return non simple structs as out parameter
- var coutparamname = "%s*".printf (prop.type_reference.get_cname ());
+ var coutparamname = "%s*".printf (prop.property_type.get_cname ());
var coutparam = new CCodeFormalParameter ("value", coutparamname);
function.add_parameter (coutparam);
} else {
@@ -2283,7 +2283,7 @@
// paramenter and insert an empty return statement afterwards.
if (current_property_accessor != null &&
current_property_accessor.readable &&
- current_property_accessor.prop.type_reference.is_real_struct_type()) {
+ current_property_accessor.prop.property_type.is_real_struct_type()) {
var cfragment = new CCodeFragment ();
cfragment.append (new CCodeExpressionStatement (new CCodeAssignment (new CCodeIdentifier ("*value"), (CCodeExpression) stmt.return_expression.ccodenode)));
cfragment.append (new CCodeReturnStatement ());
@@ -2768,7 +2768,7 @@
var ccomma = new CCodeCommaExpression ();
// assign current value to temp variable
- var temp_decl = get_temp_variable (prop.type_reference, true, expr);
+ var temp_decl = get_temp_variable (prop.property_type, true, expr);
temp_vars.insert (0, temp_decl);
ccomma.append_expression (new CCodeAssignment (new CCodeIdentifier (temp_decl.name), (CCodeExpression) expr.inner.ccodenode));
@@ -3703,7 +3703,7 @@
private CCodeStatement create_property_type_check_statement (Property prop, bool check_return_type, Typesymbol t, bool non_null, string var_name) {
if (check_return_type) {
- return create_type_check_statement (prop, prop.type_reference, t, non_null, var_name);
+ return create_type_check_statement (prop, prop.property_type, t, non_null, var_name);
} else {
return create_type_check_statement (prop, new VoidType (), t, non_null, var_name);
}
Modified: trunk/gobject/valaccodememberaccessbinding.vala
==============================================================================
--- trunk/gobject/valaccodememberaccessbinding.vala (original)
+++ trunk/gobject/valaccodememberaccessbinding.vala Tue May 13 09:05:32 2008
@@ -141,9 +141,9 @@
// Property acesses to real struct types are handeled different to other properties.
// They are returned as out parameter.
- if (base_property.type_reference.is_real_struct_type ()) {
+ if (base_property.property_type.is_real_struct_type ()) {
var ccomma = new CCodeCommaExpression ();
- var temp_var = codegen.get_temp_variable (base_property.type_reference);
+ var temp_var = codegen.get_temp_variable (base_property.property_type);
var ctemp = new CCodeIdentifier (temp_var.name);
codegen.temp_vars.add (temp_var);
ccall.add_argument (new CCodeUnaryExpression(CCodeUnaryOperator.ADDRESS_OF, ctemp));
@@ -201,7 +201,7 @@
if (codegen.current_property_accessor != null &&
codegen.current_property_accessor.writable &&
codegen.current_property_accessor.value_parameter == p &&
- codegen.current_property_accessor.prop.type_reference.is_real_struct_type ()) {
+ codegen.current_property_accessor.prop.property_type.is_real_struct_type ()) {
expr.ccodenode = new CCodeIdentifier ("(*value)");
} else {
expr.ccodenode = new CCodeIdentifier (p.name);
Modified: trunk/gobject/valaccodetypesymbolbinding.vala
==============================================================================
--- trunk/gobject/valaccodetypesymbolbinding.vala (original)
+++ trunk/gobject/valaccodetypesymbolbinding.vala Tue May 13 09:05:32 2008
@@ -29,14 +29,14 @@
cspec.add_argument (prop.get_canonical_cconstant ());
cspec.add_argument (new CCodeConstant ("\"%s\"".printf (prop.nick)));
cspec.add_argument (new CCodeConstant ("\"%s\"".printf (prop.blurb)));
- if ((prop.type_reference.data_type is Class && ((Class) prop.type_reference.data_type).is_subtype_of (codegen.gobject_type)) || prop.type_reference.data_type is Interface) {
+ if ((prop.property_type.data_type is Class && ((Class) prop.property_type.data_type).is_subtype_of (codegen.gobject_type)) || prop.property_type.data_type is Interface) {
cspec.call = new CCodeIdentifier ("g_param_spec_object");
- cspec.add_argument (new CCodeIdentifier (prop.type_reference.data_type.get_upper_case_cname ("TYPE_")));
- } else if (prop.type_reference.data_type == codegen.string_type.data_type) {
+ cspec.add_argument (new CCodeIdentifier (prop.property_type.data_type.get_upper_case_cname ("TYPE_")));
+ } else if (prop.property_type.data_type == codegen.string_type.data_type) {
cspec.call = new CCodeIdentifier ("g_param_spec_string");
cspec.add_argument (new CCodeConstant ("NULL"));
- } else if (prop.type_reference.data_type is Enum) {
- var e = prop.type_reference.data_type as Enum;
+ } else if (prop.property_type.data_type is Enum) {
+ var e = prop.property_type.data_type as Enum;
if (e.has_type_id) {
if (e.is_flags) {
cspec.call = new CCodeIdentifier ("g_param_spec_flags");
@@ -59,10 +59,10 @@
if (prop.default_expression != null) {
cspec.add_argument ((CCodeExpression) prop.default_expression.ccodenode);
} else {
- cspec.add_argument (new CCodeConstant (prop.type_reference.data_type.get_default_value ()));
+ cspec.add_argument (new CCodeConstant (prop.property_type.data_type.get_default_value ()));
}
- } else if (prop.type_reference.data_type is Struct) {
- var st = (Struct) prop.type_reference.data_type;
+ } else if (prop.property_type.data_type is Struct) {
+ var st = (Struct) prop.property_type.data_type;
if (st.get_type_id () == "G_TYPE_INT") {
cspec.call = new CCodeIdentifier ("g_param_spec_int");
cspec.add_argument (new CCodeConstant ("G_MININT"));
Modified: trunk/gobject/valagidlwriter.vala
==============================================================================
--- trunk/gobject/valagidlwriter.vala (original)
+++ trunk/gobject/valagidlwriter.vala Tue May 13 09:05:32 2008
@@ -432,7 +432,7 @@
}
write_indent ();
- stream.printf ("<property name=\"%s\" type=\"%s\"", prop.name, get_gidl_type_name (prop.type_reference));
+ stream.printf ("<property name=\"%s\" type=\"%s\"", prop.name, get_gidl_type_name (prop.property_type));
if (prop.get_accessor != null) {
stream.printf (" readable=\"1\"");
}
Modified: trunk/vala/valaclass.vala
==============================================================================
--- trunk/vala/valaclass.vala (original)
+++ trunk/vala/valaclass.vala Tue May 13 09:05:32 2008
@@ -286,7 +286,7 @@
if (empty_get && empty_set) {
/* automatic property accessor body generation */
- var field_type = prop.type_reference.copy ();
+ var field_type = prop.property_type.copy ();
var f = new Field ("_%s".printf (prop.name), field_type, prop.default_expression, prop.source_reference);
f.access = SymbolAccessibility.PRIVATE;
prop.field = f;
Modified: trunk/vala/valainterfacewriter.vala
==============================================================================
--- trunk/vala/valainterfacewriter.vala (original)
+++ trunk/vala/valainterfacewriter.vala Tue May 13 09:05:32 2008
@@ -733,13 +733,13 @@
} else if (prop.is_virtual) {
write_string ("virtual ");
}
- if (!prop.type_reference.takes_ownership) {
+ if (!prop.property_type.takes_ownership) {
write_string ("weak ");
}
- write_type (prop.type_reference);
+ write_type (prop.property_type);
- if (prop.type_reference.transfers_ownership) {
+ if (prop.property_type.transfers_ownership) {
write_string ("#");
}
Modified: trunk/vala/valamemorymanager.vala
==============================================================================
--- trunk/vala/valamemorymanager.vala (original)
+++ trunk/vala/valamemorymanager.vala Tue May 13 09:05:32 2008
@@ -189,7 +189,7 @@
} else if (current_symbol is Property) {
/* property get accessor */
var prop = (Property) current_symbol;
- if (prop.type_reference.transfers_ownership) {
+ if (prop.property_type.transfers_ownership) {
visit_possibly_missing_copy_expression (stmt.return_expression);
} else {
visit_possibly_leaked_expression (stmt.return_expression);
Modified: trunk/vala/valaproperty.vala
==============================================================================
--- trunk/vala/valaproperty.vala (original)
+++ trunk/vala/valaproperty.vala Tue May 13 09:05:32 2008
@@ -29,7 +29,7 @@
/**
* The property type.
*/
- public DataType type_reference {
+ public DataType property_type {
get { return _data_type; }
set {
_data_type = value;
@@ -160,12 +160,12 @@
* @param source reference to source code
* @return newly created property
*/
- public Property (string _name, DataType type, PropertyAccessor? _get_accessor, PropertyAccessor? _set_accessor, SourceReference source) {
- name = _name;
- type_reference = type;
- get_accessor = _get_accessor;
- set_accessor = _set_accessor;
- source_reference = source;
+ public Property (string name, DataType property_type, PropertyAccessor? get_accessor, PropertyAccessor? set_accessor, SourceReference source_reference) {
+ this.name = name;
+ this.property_type = property_type;
+ this.get_accessor = get_accessor;
+ this.set_accessor = set_accessor;
+ this.source_reference = source_reference;
}
public override void accept (CodeVisitor visitor) {
@@ -175,7 +175,7 @@
}
public override void accept_children (CodeVisitor visitor) {
- type_reference.accept (visitor);
+ property_type.accept (visitor);
if (get_accessor != null) {
get_accessor.accept (visitor);
@@ -265,7 +265,7 @@
* property
*/
public bool equals (Property prop2) {
- if (!prop2.type_reference.equals (type_reference)) {
+ if (!prop2.property_type.equals (property_type)) {
return false;
}
@@ -292,8 +292,8 @@
}
public override void replace_type (DataType old_type, DataType new_type) {
- if (type_reference == old_type) {
- type_reference = new_type;
+ if (property_type == old_type) {
+ property_type = new_type;
}
}
}
Modified: trunk/vala/valasemanticanalyzer.vala
==============================================================================
--- trunk/vala/valasemanticanalyzer.vala (original)
+++ trunk/vala/valasemanticanalyzer.vala Tue May 13 09:05:32 2008
@@ -654,9 +654,9 @@
prop.accept_children (this);
// check whether property type is at least as accessible as the property
- if (!is_type_accessible (prop, prop.type_reference)) {
+ if (!is_type_accessible (prop, prop.property_type)) {
prop.error = true;
- Report.error (prop.source_reference, "property type `%s` is less accessible than property `%s`".printf (prop.type_reference.to_string (), prop.get_full_name ()));
+ Report.error (prop.source_reference, "property type `%s` is less accessible than property `%s`".printf (prop.property_type.to_string (), prop.get_full_name ()));
return;
}
@@ -667,21 +667,21 @@
* Reference counting types can simulate to return a weak
* reference */
if ((prop.is_abstract || prop.is_virtual) &&
- prop.type_reference.data_type != null &&
- prop.type_reference.data_type.is_reference_type () &&
- !prop.type_reference.data_type.is_reference_counting () &&
- !prop.type_reference.transfers_ownership)
+ prop.property_type.data_type != null &&
+ prop.property_type.data_type.is_reference_type () &&
+ !prop.property_type.data_type.is_reference_counting () &&
+ !prop.property_type.transfers_ownership)
{
- Report.error (prop.source_reference, "%s: abstract or virtual properties using reference types not supporting reference counting, like `%s', have to mark their return value to transfer ownership.".printf (prop.get_full_name (), prop.type_reference.data_type.get_full_name ()));
+ Report.error (prop.source_reference, "%s: abstract or virtual properties using reference types not supporting reference counting, like `%s', have to mark their return value to transfer ownership.".printf (prop.get_full_name (), prop.property_type.data_type.get_full_name ()));
prop.error = true;
}
current_symbol = current_symbol.parent_symbol;
if (!prop.is_internal_symbol ()) {
- current_source_file.add_type_dependency (prop.type_reference, SourceFileDependencyType.HEADER_SHALLOW);
+ current_source_file.add_type_dependency (prop.property_type, SourceFileDependencyType.HEADER_SHALLOW);
}
- current_source_file.add_type_dependency (prop.type_reference, SourceFileDependencyType.SOURCE);
+ current_source_file.add_type_dependency (prop.property_type, SourceFileDependencyType.SOURCE);
if (prop.parent_symbol is Class) {
var cl = (Class) prop.parent_symbol;
@@ -712,7 +712,7 @@
acc.prop = (Property) current_symbol;
if (acc.readable) {
- current_return_type = acc.prop.type_reference;
+ current_return_type = acc.prop.property_type;
} else {
// void
current_return_type = new VoidType ();
@@ -739,7 +739,7 @@
}
if (acc.body != null && (acc.writable || acc.construction)) {
- var value_type = acc.prop.type_reference.copy ();
+ var value_type = acc.prop.property_type.copy ();
value_type.takes_ownership = value_type.transfers_ownership;
acc.value_parameter = new FormalParameter ("value", value_type, acc.source_reference);
acc.body.scope.add (acc.value_parameter.name, acc.value_parameter);
@@ -1392,7 +1392,7 @@
return c.type_reference;
} else if (sym is Property) {
var prop = (Property) sym;
- var type = prop.type_reference.copy ();
+ var type = prop.property_type.copy ();
type.takes_ownership = false;
return type;
} else if (sym is FormalParameter) {
@@ -2463,7 +2463,7 @@
member_type = f.field_type;
} else if (init.symbol_reference is Property) {
var prop = (Property) init.symbol_reference;
- member_type = prop.type_reference;
+ member_type = prop.property_type;
if (prop.set_accessor == null || !prop.set_accessor.writable) {
init.error = true;
Report.error (init.source_reference, "Property `%s' is read-only".printf (prop.get_full_name ()));
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]