]> git.ipfire.org Git - thirdparty/vala.git/commitdiff
Report error when variable or property type is void
authorJiří Zárevúcky <zarevucky.jiri@gmail.com>
Tue, 19 Oct 2010 16:01:20 +0000 (18:01 +0200)
committerJürg Billeter <j@bitron.ch>
Tue, 19 Oct 2010 18:59:09 +0000 (20:59 +0200)
Fixes bug 628693.

vala/valafield.vala
vala/valaformalparameter.vala
vala/valalocalvariable.vala
vala/valaproperty.vala

index 07281f24683b0e4faa53cd19cfe96769dbc8129e..34ce1a09b6afe873c5ce91f45483938e84eaf9c9 100644 (file)
@@ -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
index 4aefdf1b474992e2a6c3e8f5f5eadcc32b7ccb6e..7c0cf57ed5ff305f4b20d47272bd0585ff990799 100644 (file)
@@ -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);
                }
 
index 5ef1107fba7a4b81a084dadd5604fd0849eb482e..4ed1ec2266850acead1863d07ee8d6beae2906f0 100644 (file)
@@ -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);
                }
 
index f2024442afc79184310cfc384e896a907f3a4dc1..6fad504988dfccf9271ea2b858db303f7e650fa0 100644 (file)
@@ -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) {