[vala/0.10] Make address-of operator work on all variables
- From: Jürg Billeter <juergbi src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [vala/0.10] Make address-of operator work on all variables
- Date: Fri, 8 Oct 2010 21:18:16 +0000 (UTC)
commit 2daebdf68f24ed95cc9b14686accf952723d9640
Author: Jürg Billeter <j bitron ch>
Date: Sun Oct 3 12:19:24 2010 -0700
Make address-of operator work on all variables
Fixes bug 631247.
vala/valaaddressofexpression.vala | 9 +++++----
1 files changed, 5 insertions(+), 4 deletions(-)
---
diff --git a/vala/valaaddressofexpression.vala b/vala/valaaddressofexpression.vala
index c6804d6..83754e5 100644
--- a/vala/valaaddressofexpression.vala
+++ b/vala/valaaddressofexpression.vala
@@ -81,10 +81,11 @@ public class Vala.AddressofExpression : Expression {
error = true;
return false;
}
- if (!(inner.value_type is ValueType
- || inner.value_type is ObjectType
- || inner.value_type is PointerType
- || inner.value_type is GenericType)) {
+ 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 {
error = true;
Report.error (source_reference, "Address-of operator not supported for this expression");
return false;
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]