[vala] Report error when accessing constants of outer methods



commit d72b93c136b6fcc1dfa2cba10e45e676edfe0cc9
Author: JÃrg Billeter <j bitron ch>
Date:   Sun Jun 24 17:02:01 2012 +0200

    Report error when accessing constants of outer methods
    
    This is planned to be supported.
    
    https://bugzilla.gnome.org/show_bug.cgi?id=678617

 vala/valamemberaccess.vala |    7 +++++++
 1 files changed, 7 insertions(+), 0 deletions(-)
---
diff --git a/vala/valamemberaccess.vala b/vala/valamemberaccess.vala
index 3958777..358693e 100644
--- a/vala/valamemberaccess.vala
+++ b/vala/valamemberaccess.vala
@@ -532,6 +532,13 @@ public class Vala.MemberAccess : Expression {
 		} else if (member is Constant) {
 			var c = (Constant) member;
 			access = c.access;
+
+			var block = c.parent_symbol as Block;
+			if (block != null && context.analyzer.find_parent_method_or_property_accessor (block) != context.analyzer.current_method_or_property_accessor) {
+				error = true;
+				Report.error (source_reference, "internal error: accessing local constants of outer methods is not supported yet");
+				return false;
+			}
 		} else if (member is Method) {
 			var m = (Method) member;
 			if (m.is_async_callback) {



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