]> git.ipfire.org Git - thirdparty/vala.git/commitdiff
Report error when using instance member as initializer in static method
authorJürg Billeter <j@bitron.ch>
Mon, 22 Mar 2010 18:43:32 +0000 (19:43 +0100)
committerJürg Billeter <j@bitron.ch>
Mon, 22 Mar 2010 18:43:32 +0000 (19:43 +0100)
vala/valalocalvariable.vala

index 72dbe8371d74cd87d7b24c43ef05e8062f17661c..f0450340a0f2dd65ca2761e180c53e5925b1a212 100644 (file)
@@ -140,6 +140,11 @@ public class Vala.LocalVariable : Symbol {
                                Report.error (source_reference, "var declaration not allowed with non-typed initializer");
                                return false;
                        }
+                       if (initializer.value_type is FieldPrototype) {
+                               error = true;
+                               Report.error (initializer.source_reference, "Access to instance member `%s' denied".printf (initializer.symbol_reference.get_full_name ()));
+                               return false;
+                       }
 
                        variable_type = initializer.value_type.copy ();
                        variable_type.value_owned = true;