[vala] Do not support assigning to `this'



commit 95b2e15a05fdd6ffa2a75654f06932378cd8ebbb
Author: Luca Bruno <lethalman88 gmail com>
Date:   Wed Jun 2 11:11:03 2010 +0200

    Do not support assigning to `this'
    
    Fixes bug 620120.

 vala/valaassignment.vala |    3 ++-
 1 files changed, 2 insertions(+), 1 deletions(-)
---
diff --git a/vala/valaassignment.vala b/vala/valaassignment.vala
index 5833e6b..575ff96 100644
--- a/vala/valaassignment.vala
+++ b/vala/valaassignment.vala
@@ -145,7 +145,8 @@ public class Vala.Assignment : Expression {
 		if (left is MemberAccess) {
 			var ma = (MemberAccess) left;
 
-			if (!(ma.symbol_reference is Signal || ma.symbol_reference is DynamicProperty) && ma.value_type == null) {
+			if ((!(ma.symbol_reference is Signal || ma.symbol_reference is DynamicProperty) && ma.value_type == null) ||
+			    (ma.inner == null && ma.member_name == "this" && analyzer.is_in_instance_method ())) {
 				error = true;
 				Report.error (source_reference, "unsupported lvalue in assignment");
 				return false;



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