Commit 24155cdb authored by Jürg Billeter's avatar Jürg Billeter Committed by Jürg Billeter
Browse files

remove obsolete ctype attribute

2007-08-30  Juerg Billeter  <j@bitron.ch>

	* vala/valaclass.vala, gobject/valacodegenerator.vala,
	  gobject/valacodegeneratorinterface.vala,
	  gobject/valacodegeneratormethod.vala, vapi/glib-2.0.vala: remove
	  obsolete ctype attribute

svn path=/trunk/; revision=538
parent c390970c
2007-08-30 Jürg Billeter <j@bitron.ch>
* vala/valaclass.vala, gobject/valacodegenerator.vala,
gobject/valacodegeneratorinterface.vala,
gobject/valacodegeneratormethod.vala, vapi/glib-2.0.vala: remove
obsolete ctype attribute
2007-08-30 Jürg Billeter <j@bitron.ch>
* vala/valaclass.vala, vala/valasemanticanalyzer.vala,
......
......@@ -1794,7 +1794,7 @@ public class Vala.CodeGenerator : CodeVisitor {
if (stmt.return_expression.static_type != null &&
stmt.return_expression.static_type.data_type != current_return_type.data_type) {
/* cast required */
if ((current_return_type.data_type is Class && ((Class) current_return_type.data_type).get_is_gobject ()) ||
if ((current_return_type.data_type is Class && ((Class) current_return_type.data_type).is_subtype_of (gobject_type)) ||
current_return_type.data_type is Interface) {
stmt.return_expression.ccodenode = new InstanceCast ((CCodeExpression) stmt.return_expression.ccodenode, current_return_type.data_type);
}
......@@ -2502,7 +2502,7 @@ public class Vala.CodeGenerator : CodeVisitor {
}
public override void visit_cast_expression (CastExpression! expr) {
if ((expr.type_reference.data_type is Class && ((Class) expr.type_reference.data_type).get_is_gobject ()) || expr.type_reference.data_type is Interface) {
if ((expr.type_reference.data_type is Class && ((Class) expr.type_reference.data_type).is_subtype_of (gobject_type)) || expr.type_reference.data_type is Interface) {
// GObject cast
if (expr.is_silent_cast) {
var ccomma = new CCodeCommaExpression ();
......@@ -2599,8 +2599,8 @@ public class Vala.CodeGenerator : CodeVisitor {
if (expr.operator == BinaryOperator.EQUALITY ||
expr.operator == BinaryOperator.INEQUALITY) {
if (expr.left.static_type != null && expr.right.static_type != null &&
expr.left.static_type.data_type is Class && ((Class) expr.left.static_type.data_type).get_is_gobject () &&
expr.right.static_type.data_type is Class && ((Class) expr.right.static_type.data_type).get_is_gobject ()) {
expr.left.static_type.data_type is Class && ((Class) expr.left.static_type.data_type).is_subtype_of (gobject_type) &&
expr.right.static_type.data_type is Class && ((Class) expr.right.static_type.data_type).is_subtype_of (gobject_type)) {
var left_cl = (Class) expr.left.static_type.data_type;
var right_cl = (Class) expr.right.static_type.data_type;
......
......@@ -98,7 +98,7 @@ public class Vala.CodeGenerator {
cspec.add_argument (prop.get_canonical_cconstant ());
cspec.add_argument (new CCodeConstant ("\"foo\""));
cspec.add_argument (new CCodeConstant ("\"bar\""));
if ((prop.type_reference.data_type is Class && ((Class) prop.type_reference.data_type).get_is_gobject ()) || prop.type_reference.data_type is Interface) {
if ((prop.type_reference.data_type is Class && ((Class) prop.type_reference.data_type).is_subtype_of (gobject_type)) || prop.type_reference.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 == string_type.data_type) {
......
......@@ -467,7 +467,7 @@ public class Vala.CodeGenerator {
private CCodeStatement create_type_check_statement (CodeNode! method_node, DataType ret_type, DataType! t, bool non_null, string! var_name) {
var ccheck = new CCodeFunctionCall ();
if ((t is Class && ((Class) t).get_is_gobject ()) || (t is Interface && !((Interface) t).declaration_only)) {
if ((t is Class && ((Class) t).is_subtype_of (gobject_type)) || (t is Interface && !((Interface) t).declaration_only)) {
var ctype_check = new CCodeFunctionCall (new CCodeIdentifier (t.get_upper_case_cname ("IS_")));
ctype_check.add_argument (new CCodeIdentifier (var_name));
......
......@@ -53,7 +53,6 @@ public class Vala.Class : DataType {
}
}
private bool is_gobject = true;
private string cname;
private string const_cname;
private string lower_case_cprefix;
......@@ -381,24 +380,11 @@ public class Vala.Class : DataType {
return get_lower_case_cname (infix).up ();
}
public bool get_is_gobject () {
return is_gobject;
}
public void set_is_gobject (bool is_gobject) {
this.is_gobject = is_gobject;
}
public override bool is_reference_type () {
return true;
}
private void process_ccode_attribute (Attribute! a) {
if (a.has_argument ("ctype")) {
if (a.get_string ("ctype") != "gobject") {
is_gobject = false;
}
}
if (a.has_argument ("ref_function")) {
set_ref_function (a.get_string ("ref_function"));
}
......@@ -465,8 +451,8 @@ public class Vala.Class : DataType {
public override string get_marshaller_type_name () {
if (marshaller_type_name == null) {
if (is_gobject) {
marshaller_type_name = "OBJECT";
if (base_class != null) {
marshaller_type_name = base_class.get_marshaller_type_name ();
} else {
marshaller_type_name = "POINTER";
}
......@@ -477,8 +463,8 @@ public class Vala.Class : DataType {
public override string get_get_value_function () {
if (get_value_function == null) {
if (is_gobject) {
get_value_function = "g_value_get_object";
if (base_class != null) {
get_value_function = base_class.get_get_value_function ();
} else {
get_value_function = "g_value_get_pointer";
}
......@@ -489,8 +475,8 @@ public class Vala.Class : DataType {
public override string get_set_value_function () {
if (set_value_function == null) {
if (is_gobject) {
set_value_function = "g_value_set_object";
if (base_class != null) {
set_value_function = base_class.get_set_value_function ();
} else {
set_value_function = "g_value_set_pointer";
}
......
......@@ -627,7 +627,7 @@ namespace GLib {
public static delegate void ObjectGetPropertyFunc (Object object, uint property_id, Value value, ParamSpec pspec);
public static delegate void ObjectSetPropertyFunc (Object object, uint property_id, Value value, ParamSpec pspec);
[CCode (ref_function = "g_object_ref", unref_function = "g_object_unref", cheader_filename = "glib-object.h")]
[CCode (ref_function = "g_object_ref", unref_function = "g_object_unref", marshaller_type_name = "OBJECT", get_value_function = "g_value_get_object", set_value_function = "g_value_set_object", cheader_filename = "glib-object.h")]
public class Object {
[CCode (cname = "G_TYPE_FROM_INSTANCE")]
public Type get_type ();
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment