[vala/0.10] Report error when variable or property type is void



commit 31c4d73bef1af912b2b4aaadc64a515d7bc4bf0f
Author: JiÅ?í Zárevúcky <zarevucky jiri gmail com>
Date:   Tue Oct 19 18:01:20 2010 +0200

    Report error when variable or property type is void
    
    Fixes bug 628693.

 vala/valafield.vala           |    6 ++++++
 vala/valaformalparameter.vala |    5 +++++
 vala/valalocalvariable.vala   |    5 +++++
 vala/valaproperty.vala        |    6 ++++++
 4 files changed, 22 insertions(+), 0 deletions(-)
---
diff --git a/vala/valafield.vala b/vala/valafield.vala
index 07281f2..34ce1a0 100644
--- a/vala/valafield.vala
+++ b/vala/valafield.vala
@@ -275,6 +275,12 @@ public class Vala.Field : Variable, Lockable {
 		}
 		analyzer.current_symbol = this;
 
+		if (variable_type is VoidType) {
+			error = true;
+			Report.error (source_reference, "'void' not supported as field type");
+			return false;
+		}
+
 		variable_type.check (analyzer);
 
 		// check whether field type is at least as accessible as the field
diff --git a/vala/valaformalparameter.vala b/vala/valaformalparameter.vala
index 4aefdf1..7c0cf57 100644
--- a/vala/valaformalparameter.vala
+++ b/vala/valaformalparameter.vala
@@ -234,6 +234,11 @@ public class Vala.FormalParameter : Variable {
 		analyzer.current_symbol = parent_symbol;
 
 		if (variable_type != null) {
+			if (variable_type is VoidType) {
+				error = true;
+				Report.error (source_reference, "'void' not supported as parameter type");
+				return false;
+			}
 			variable_type.check (analyzer);
 		}
 
diff --git a/vala/valalocalvariable.vala b/vala/valalocalvariable.vala
index 5ef1107..4ed1ec2 100644
--- a/vala/valalocalvariable.vala
+++ b/vala/valalocalvariable.vala
@@ -85,6 +85,11 @@ public class Vala.LocalVariable : Variable {
 		checked = true;
 
 		if (variable_type != null) {
+			if (variable_type is VoidType) {
+				error = true;
+				Report.error (source_reference, "'void' not supported as variable type");
+				return false;
+			}
 			variable_type.check (analyzer);
 		}
 
diff --git a/vala/valaproperty.vala b/vala/valaproperty.vala
index f202444..6fad504 100644
--- a/vala/valaproperty.vala
+++ b/vala/valaproperty.vala
@@ -478,6 +478,12 @@ public class Vala.Property : Symbol, Lockable {
 		}
 		analyzer.current_symbol = this;
 
+		if (property_type is VoidType) {
+			error = true;
+			Report.error (source_reference, "'void' not supported as property type");
+			return false;
+		}
+
 		property_type.check (analyzer);
 
 		if (get_accessor != null) {



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