[vala/0.10] Fix address-of operator for pointer element access
- From: Jürg Billeter <juergbi src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [vala/0.10] Fix address-of operator for pointer element access
- Date: Fri, 8 Oct 2010 21:18:27 +0000 (UTC)
commit 9a9b4048f659e8b5a49f118b6c87d530c9ec2e64
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 83754e5..1d27aee 100644
--- a/vala/valaaddressofexpression.vala
+++ b/vala/valaaddressofexpression.vala
@@ -81,10 +81,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]