From: Jiří Zárevúcky Date: Tue, 19 Oct 2010 16:01:20 +0000 (+0200) Subject: Report error when variable or property type is void X-Git-Tag: 0.10.1~19 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=31c4d73bef1af912b2b4aaadc64a515d7bc4bf0f;p=thirdparty%2Fvala.git Report error when variable or property type is void Fixes bug 628693. --- diff --git a/vala/valafield.vala b/vala/valafield.vala index 07281f246..34ce1a09b 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 4aefdf1b4..7c0cf57ed 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 5ef1107fb..4ed1ec226 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 f2024442a..6fad50498 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) {