diff options
author | Jürg Billeter <j@bitron.ch> | 2009-10-21 21:28:28 +0200 |
---|---|---|
committer | Jürg Billeter <j@bitron.ch> | 2009-10-21 21:28:28 +0200 |
commit | ba8f9c8b66204a0680d3c7e4447a745ba9903d13 (patch) | |
tree | 5e57732873320ff3fc341767a5e1df9391109843 /vala/valamethodcall.vala | |
parent | 4fc5cbe2237df03fc4c5e94b5790380f1215df01 (diff) | |
download | vala-ba8f9c8b66204a0680d3c7e4447a745ba9903d13.tar.gz |
Support constructor chain up to GObject using Object (...)
Diffstat (limited to 'vala/valamethodcall.vala')
-rw-r--r-- | vala/valamethodcall.vala | 36 |
1 files changed, 24 insertions, 12 deletions
diff --git a/vala/valamethodcall.vala b/vala/valamethodcall.vala index aedeb96a4..ab4702432 100644 --- a/vala/valamethodcall.vala +++ b/vala/valamethodcall.vala @@ -141,7 +141,7 @@ public class Vala.MethodCall : Expression { var mtype = call.value_type; - if (mtype is ObjectType) { + if (mtype is ObjectType || (analyzer.context.profile == Profile.GOBJECT && call.symbol_reference == analyzer.object_type)) { // constructor chain-up var cm = analyzer.find_current_method () as CreationMethod; if (cm == null) { @@ -155,17 +155,29 @@ public class Vala.MethodCall : Expression { } cm.chain_up = true; - var otype = (ObjectType) mtype; - var cl = (Class) otype.type_symbol; - var base_cm = cl.default_construction_method; - if (base_cm == null) { - error = true; - Report.error (source_reference, "chain up to `%s' not supported".printf (cl.get_full_name ())); - return false; - } else if (!base_cm.has_construct_function) { - error = true; - Report.error (source_reference, "chain up to `%s' not supported".printf (base_cm.get_full_name ())); - return false; + if (mtype is ObjectType) { + var otype = (ObjectType) mtype; + var cl = (Class) otype.type_symbol; + var base_cm = cl.default_construction_method; + if (base_cm == null) { + error = true; + Report.error (source_reference, "chain up to `%s' not supported".printf (cl.get_full_name ())); + return false; + } else if (!base_cm.has_construct_function) { + error = true; + Report.error (source_reference, "chain up to `%s' not supported".printf (base_cm.get_full_name ())); + return false; + } + } else { + // GObject chain up + var cl = cm.parent_symbol as Class; + if (cl == null || !cl.is_subtype_of (analyzer.object_type)) { + error = true; + Report.error (source_reference, "chain up to `GLib.Object' not supported"); + return false; + } + call.value_type = new ObjectType (analyzer.object_type); + mtype = call.value_type; } } |