]> git.ipfire.org Git - thirdparty/vala.git/commitdiff
vala: Don't check for unhandled error if error is set on body 169b99003aa8050de9dd69c47dff57b43b82ec1e
authorRico Tzschichholz <ricotz@ubuntu.com>
Thu, 20 Feb 2020 14:19:37 +0000 (15:19 +0100)
committerRico Tzschichholz <ricotz@ubuntu.com>
Thu, 20 Feb 2020 14:22:17 +0000 (15:22 +0100)
This is how Method and CreationMethod behave already.

vala/valaconstructor.vala
vala/valapropertyaccessor.vala

index a4844c7285e7937c3e758442508add6426190aa2..a867f3a397366a32aa7c9407a7e2dcd9bd85d577 100644 (file)
@@ -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()));
+                               }
                        }
                }
 
index bb718470fab95f5c6a37801f20f8413e48d6bfcb..101fc018f740ac72cc8d4026f39b0d33564da75f 100644 (file)
@@ -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) {