[vala] Report error when using instance member as initializer in static method



commit c006b3b4f5076d52cfc902e5463cfc74d1dd6019
Author: Jürg Billeter <j bitron ch>
Date:   Mon Mar 22 19:43:32 2010 +0100

    Report error when using instance member as initializer in static method

 vala/valalocalvariable.vala |    5 +++++
 1 files changed, 5 insertions(+), 0 deletions(-)
---
diff --git a/vala/valalocalvariable.vala b/vala/valalocalvariable.vala
index 72dbe83..f045034 100644
--- a/vala/valalocalvariable.vala
+++ b/vala/valalocalvariable.vala
@@ -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;



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