diff options
author | Juerg Billeter <j@bitron.ch> | 2007-08-30 13:45:05 +0000 |
---|---|---|
committer | Jürg Billeter <juergbi@src.gnome.org> | 2007-08-30 13:45:05 +0000 |
commit | c390970c9b4ad29f44e9fe92d4440cc8cc0b9cf1 (patch) | |
tree | 1ecaa0b238623edcea47be89e01ad4ff9f1b37b4 /vala | |
parent | 475ca45f83f6c8f8fb167c70d34aac2806d305ba (diff) | |
download | vala-c390970c9b4ad29f44e9fe92d4440cc8cc0b9cf1.tar.gz |
support classes without base class
2007-08-30 Juerg Billeter <j@bitron.ch>
* vala/valaclass.vala, vala/valasemanticanalyzer.vala,
gobject/valacodegenerator.vala, gobject/valacodegeneratorclass.vala,
gobject/valacodegeneratormethod.vala, vapi/glib-2.0.vala: support
classes without base class
svn path=/trunk/; revision=537
Diffstat (limited to 'vala')
-rw-r--r-- | vala/valaclass.vala | 59 | ||||
-rw-r--r-- | vala/valasemanticanalyzer.vala | 15 |
2 files changed, 30 insertions, 44 deletions
diff --git a/vala/valaclass.vala b/vala/valaclass.vala index cf4f35e21..71c178214 100644 --- a/vala/valaclass.vala +++ b/vala/valaclass.vala @@ -397,32 +397,33 @@ public class Vala.Class : DataType { 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")); - } - if (a.has_argument ("unref_function")) { - set_unref_function (a.get_string ("unref_function")); - } - if (a.has_argument ("copy_function")) { - set_dup_function (a.get_string ("copy_function")); - } - if (a.has_argument ("free_function")) { - set_free_function (a.get_string ("free_function")); - } - if (a.has_argument ("type_id")) { - type_id = a.get_string ("type_id"); - } - if (a.has_argument ("marshaller_type_name")) { - marshaller_type_name = a.get_string ("marshaller_type_name"); - } - if (a.has_argument ("get_value_function")) { - get_value_function = a.get_string ("get_value_function"); - } - if (a.has_argument ("set_value_function")) { - set_value_function = a.get_string ("set_value_function"); - } } } + if (a.has_argument ("ref_function")) { + set_ref_function (a.get_string ("ref_function")); + } + if (a.has_argument ("unref_function")) { + set_unref_function (a.get_string ("unref_function")); + } + if (a.has_argument ("copy_function")) { + set_dup_function (a.get_string ("copy_function")); + } + if (a.has_argument ("free_function")) { + set_free_function (a.get_string ("free_function")); + } + if (a.has_argument ("type_id")) { + type_id = a.get_string ("type_id"); + } + if (a.has_argument ("marshaller_type_name")) { + marshaller_type_name = a.get_string ("marshaller_type_name"); + } + if (a.has_argument ("get_value_function")) { + get_value_function = a.get_string ("get_value_function"); + } + if (a.has_argument ("set_value_function")) { + set_value_function = a.get_string ("set_value_function"); + } + if (a.has_argument ("cname")) { set_cname (a.get_string ("cname")); } @@ -499,12 +500,12 @@ public class Vala.Class : DataType { } public override bool is_reference_counting () { - return is_gobject || (ref_function != null && unref_function != null); + return get_ref_function () != null; } public override string get_ref_function () { - if (is_gobject) { - return "g_object_ref"; + if (ref_function == null && base_class != null) { + return base_class.get_ref_function (); } else { return ref_function; } @@ -515,8 +516,8 @@ public class Vala.Class : DataType { } public override string get_unref_function () { - if (is_gobject) { - return "g_object_unref"; + if (unref_function == null && base_class != null) { + return base_class.get_unref_function (); } else { return unref_function; } diff --git a/vala/valasemanticanalyzer.vala b/vala/valasemanticanalyzer.vala index 82b4cf60e..cadc9ea05 100644 --- a/vala/valasemanticanalyzer.vala +++ b/vala/valasemanticanalyzer.vala @@ -466,21 +466,6 @@ public class Vala.SemanticAnalyzer : CodeVisitor { Report.error (m.source_reference, "The creation method `%s' cannot be marked as override, virtual, or abstract".printf (m.get_full_name ())); return; } - - if (m.body != null && current_class != null) { - int n_params = 0; - foreach (Statement stmt in m.body.get_statements ()) { - if (!(stmt is ExpressionStatement) || ((ExpressionStatement) stmt).assigned_property () == null) { - m.error = true; - Report.error (stmt.source_reference, "class creation methods only allow property assignment statements"); - return; - } - if (((ExpressionStatement) stmt).assigned_property ().set_accessor.construction) { - n_params++; - } - } - m.n_construction_params = n_params; - } } public override void visit_formal_parameter (FormalParameter! p) { |