summaryrefslogtreecommitdiff
path: root/vala
diff options
context:
space:
mode:
authorJürg Billeter <j@bitron.ch>2010-02-10 10:59:51 +0100
committerJürg Billeter <j@bitron.ch>2010-02-10 11:00:41 +0100
commitb7a5be2f5a2b1d2c4ab03d6e74251f41c53ce893 (patch)
treeb2d5fda3574734a4d3756f43962bab464f7ece3d /vala
parent8993321d20b2ddb6b0484323e27670b67abdf0bc (diff)
downloadvala-b7a5be2f5a2b1d2c4ab03d6e74251f41c53ce893.tar.gz
Allow using array element access as ref and out method arguments
Fixes bug 609388.
Diffstat (limited to 'vala')
-rw-r--r--vala/valaunaryexpression.vala8
1 files changed, 5 insertions, 3 deletions
diff --git a/vala/valaunaryexpression.vala b/vala/valaunaryexpression.vala
index a171c8e7c..53ebd9a6b 100644
--- a/vala/valaunaryexpression.vala
+++ b/vala/valaunaryexpression.vala
@@ -215,13 +215,15 @@ public class Vala.UnaryExpression : Expression {
assignment.check (analyzer);
return true;
} else if (operator == UnaryOperator.REF || operator == UnaryOperator.OUT) {
- if (inner.symbol_reference is Field || inner.symbol_reference is FormalParameter || inner.symbol_reference is LocalVariable) {
- // ref and out can only be used with fields, parameters, and local variables
+ var ea = inner as ElementAccess;
+ if (inner.symbol_reference is Field || inner.symbol_reference is FormalParameter || inner.symbol_reference is LocalVariable ||
+ (ea != null && ea.container.value_type is ArrayType)) {
+ // ref and out can only be used with fields, parameters, local variables, and array element access
lvalue = true;
value_type = inner.value_type;
} else {
error = true;
- Report.error (source_reference, "ref and out method arguments can only be used with fields, parameters, and local variables");
+ Report.error (source_reference, "ref and out method arguments can only be used with fields, parameters, local variables, and array element access");
return false;
}
} else {