[vala] Report error when throwing internal errors from public methods
- From: Jürg Billeter <juergbi src gnome org>
- To: commits-list gnome org
- Cc: 
- Subject: [vala] Report error when throwing internal errors from public methods
- Date: Tue, 14 Sep 2010 07:35:34 +0000 (UTC)
commit 645c75f135d29343241761b574d5eacee600dd8e
Author: Jürg Billeter <j bitron ch>
Date:   Tue Sep 14 09:34:09 2010 +0200
    Report error when throwing internal errors from public methods
 vala/valamethod.vala |    7 +++++++
 1 files changed, 7 insertions(+), 0 deletions(-)
---
diff --git a/vala/valamethod.vala b/vala/valamethod.vala
index 446a3f7..d48d356 100644
--- a/vala/valamethod.vala
+++ b/vala/valamethod.vala
@@ -887,6 +887,13 @@ public class Vala.Method : Symbol {
 
 		foreach (DataType error_type in get_error_types ()) {
 			error_type.check (analyzer);
+
+			// check whether error type is at least as accessible as the method
+			if (!analyzer.is_type_accessible (this, error_type)) {
+				error = true;
+				Report.error (source_reference, "error type `%s` is less accessible than method `%s`".printf (error_type.to_string (), get_full_name ()));
+				return false;
+			}
 		}
 
 		if (result_var != null) {
[
Date Prev][
Date Next]   [
Thread Prev][
Thread Next]   
[
Thread Index]
[
Date Index]
[
Author Index]