From: Rico Tzschichholz Date: Sun, 28 Apr 2019 07:22:13 +0000 (+0200) Subject: codegen: Move construct property checks to SemanticAnalyzer pass X-Git-Tag: 0.45.1~33 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=6c8c75f59024b32230b1c13ea344a568f19b86df;p=thirdparty%2Fvala.git codegen: Move construct property checks to SemanticAnalyzer pass --- diff --git a/codegen/valaccodebasemodule.vala b/codegen/valaccodebasemodule.vala index f0d03ba78..9a134f33f 100644 --- a/codegen/valaccodebasemodule.vala +++ b/codegen/valaccodebasemodule.vala @@ -1640,16 +1640,6 @@ public abstract class Vala.CCodeBaseModule : CodeGenerator { var t = (TypeSymbol) prop.parent_symbol; - if (acc.construction && !t.is_subtype_of (gobject_type)) { - Report.error (acc.source_reference, "construct properties require GLib.Object"); - acc.error = true; - return; - } else if (acc.construction && !context.analyzer.is_gobject_property (prop)) { - Report.error (acc.source_reference, "construct properties not supported for specified property type"); - acc.error = true; - return; - } - // do not declare overriding properties and interface implementations if (prop.is_abstract || prop.is_virtual || (prop.base_property == null && prop.base_interface_property == null)) { diff --git a/vala/valapropertyaccessor.vala b/vala/valapropertyaccessor.vala index e348c2510..f9fc98171 100644 --- a/vala/valapropertyaccessor.vala +++ b/vala/valapropertyaccessor.vala @@ -184,6 +184,16 @@ public class Vala.PropertyAccessor : Subroutine { return false; } + if (construction && !((TypeSymbol) prop.parent_symbol).is_subtype_of (context.analyzer.object_type)) { + error = true; + Report.error (source_reference, "construct properties require `GLib.Object'"); + return false; + } else if (construction && !context.analyzer.is_gobject_property (prop)) { + error = true; + Report.error (source_reference, "construct properties not supported for specified property type"); + return false; + } + if (body != null && prop.is_abstract) { error = true; Report.error (source_reference, "Accessor of abstract property `%s' cannot have body".printf (prop.get_full_name ()));