[vala] Fix crash when using postfix expressions with read-only properties
- From: Jürg Billeter <juergbi src gnome org>
- To: svn-commits-list gnome org
- Cc:
- Subject: [vala] Fix crash when using postfix expressions with read-only properties
- Date: Mon, 14 Sep 2009 15:38:43 +0000 (UTC)
commit 24be8d8e51f3302db40460f667b15d8412842de0
Author: Jürg Billeter <j bitron ch>
Date: Mon Sep 14 17:37:45 2009 +0200
Fix crash when using postfix expressions with read-only properties
Fixes bug 595145.
vala/valapostfixexpression.vala | 16 +++++++++++++++-
1 files changed, 15 insertions(+), 1 deletions(-)
---
diff --git a/vala/valapostfixexpression.vala b/vala/valapostfixexpression.vala
index 3157c67..1ed72e1 100644
--- a/vala/valapostfixexpression.vala
+++ b/vala/valapostfixexpression.vala
@@ -1,6 +1,6 @@
/* valapostfixexpression.vala
*
- * Copyright (C) 2006-2008 Jürg Billeter
+ * Copyright (C) 2006-2009 Jürg Billeter
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
@@ -100,6 +100,20 @@ public class Vala.PostfixExpression : Expression {
return false;
}
+ if (inner is MemberAccess) {
+ var ma = (MemberAccess) inner;
+
+ if (ma.symbol_reference is Property) {
+ var prop = (Property) ma.symbol_reference;
+
+ if (prop.set_accessor == null || !prop.set_accessor.writable) {
+ ma.error = true;
+ Report.error (ma.source_reference, "Property `%s' is read-only".printf (prop.get_full_name ()));
+ return false;
+ }
+ }
+ }
+
value_type = inner.value_type;
return !error;
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]