[vala/0.40] vala: Don't check for unhandled error if error is set on body



commit 2684758042670032cd643c240fa7876c78716f5a
Author: Rico Tzschichholz <ricotz ubuntu com>
Date:   Thu Feb 20 15:19:37 2020 +0100

    vala: Don't check for unhandled error if error is set on body
    
    This is how Method and CreationMethod behave already.

 vala/valaconstructor.vala      | 8 +++++---
 vala/valapropertyaccessor.vala | 2 ++
 2 files changed, 7 insertions(+), 3 deletions(-)
---
diff --git a/vala/valaconstructor.vala b/vala/valaconstructor.vala
index d16fc13a4..5fc4d9592 100644
--- a/vala/valaconstructor.vala
+++ b/vala/valaconstructor.vala
@@ -77,9 +77,11 @@ public class Vala.Constructor : Subroutine {
                        body.check (context);
                }
 
-               foreach (DataType body_error_type in body.get_error_types ()) {
-                       if (!((ErrorType) body_error_type).dynamic_error) {
-                               Report.warning (body_error_type.source_reference, "unhandled error 
`%s'".printf (body_error_type.to_string()));
+               if (body != null && !body.error) {
+                       foreach (DataType body_error_type in body.get_error_types ()) {
+                               if (!((ErrorType) body_error_type).dynamic_error) {
+                                       Report.warning (body_error_type.source_reference, "unhandled error 
`%s'".printf (body_error_type.to_string()));
+                               }
                        }
                }
 
diff --git a/vala/valapropertyaccessor.vala b/vala/valapropertyaccessor.vala
index 79227e23d..293205aa9 100644
--- a/vala/valapropertyaccessor.vala
+++ b/vala/valapropertyaccessor.vala
@@ -208,7 +208,9 @@ public class Vala.PropertyAccessor : Subroutine {
                        }
 
                        body.check (context);
+               }
 
+               if (body != null && !body.error) {
                        foreach (DataType body_error_type in body.get_error_types ()) {
                                if (!((ErrorType) body_error_type).dynamic_error) {
                                        Report.warning (body_error_type.source_reference, "unhandled error 
`%s'".printf (body_error_type.to_string()));


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