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



commit 169b99003aa8050de9dd69c47dff57b43b82ec1e
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      | 12 +++++++-----
 vala/valapropertyaccessor.vala |  2 ++
 2 files changed, 9 insertions(+), 5 deletions(-)
---
diff --git a/vala/valaconstructor.vala b/vala/valaconstructor.vala
index a4844c728..a867f3a39 100644
--- a/vala/valaconstructor.vala
+++ b/vala/valaconstructor.vala
@@ -77,11 +77,13 @@ public class Vala.Constructor : Subroutine {
                        body.check (context);
                }
 
-               var body_errors = new ArrayList<DataType> ();
-               body.get_error_types (body_errors);
-               foreach (DataType body_error_type in body_errors) {
-                       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) {
+                       var body_errors = new ArrayList<DataType> ();
+                       body.get_error_types (body_errors);
+                       foreach (DataType body_error_type in body_errors) {
+                               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 bb718470f..101fc018f 100644
--- a/vala/valapropertyaccessor.vala
+++ b/vala/valapropertyaccessor.vala
@@ -238,7 +238,9 @@ public class Vala.PropertyAccessor : Subroutine {
                        }
 
                        body.check (context);
+               }
 
+               if (body != null && !body.error) {
                        var error_types = new ArrayList<DataType> ();
                        body.get_error_types (error_types);
                        foreach (DataType body_error_type in error_types) {


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