[vala] Fix address-of operator for pointer element access
- From: Jürg Billeter <juergbi src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [vala] Fix address-of operator for pointer element access
- Date: Thu, 7 Oct 2010 21:03:24 +0000 (UTC)
commit c4916e2d6b847757638c71582d2431cd86545173
Author: Jürg Billeter <j bitron ch>
Date: Thu Oct 7 18:44:03 2010 +0200
Fix address-of operator for pointer element access
vala/valaaddressofexpression.vala | 6 ++++--
1 files changed, 4 insertions(+), 2 deletions(-)
---
diff --git a/vala/valaaddressofexpression.vala b/vala/valaaddressofexpression.vala
index 6ac0b1e..1033ccc 100644
--- a/vala/valaaddressofexpression.vala
+++ b/vala/valaaddressofexpression.vala
@@ -83,10 +83,12 @@ public class Vala.AddressofExpression : Expression {
error = true;
return false;
}
+ var ea = inner as ElementAccess;
if (inner is MemberAccess && inner.symbol_reference is Variable) {
// address of variable is always possible
- } else if (inner is ElementAccess && ((ElementAccess) inner).container.value_type is ArrayType) {
- // address of element of regular array is always possible
+ } else if (ea != null &&
+ (ea.container.value_type is ArrayType || ea.container.value_type is PointerType)) {
+ // address of element of regular array or pointer is always possible
} else {
error = true;
Report.error (source_reference, "Address-of operator not supported for this expression");
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]