[vala/0.44] codegen: Move construct property checks to SemanticAnalyzer pass



commit 7a4325b037b86cc4a7baf3dbd3fc960a59c8cf1e
Author: Rico Tzschichholz <ricotz ubuntu com>
Date:   Sun Apr 28 09:22:13 2019 +0200

    codegen: Move construct property checks to SemanticAnalyzer pass

 codegen/valaccodebasemodule.vala | 10 ----------
 vala/valapropertyaccessor.vala   | 10 ++++++++++
 2 files changed, 10 insertions(+), 10 deletions(-)
---
diff --git a/codegen/valaccodebasemodule.vala b/codegen/valaccodebasemodule.vala
index 9dfbb1ad6..bb29c2328 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 ()));


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]