vala r2306 - in trunk: . vala
- From: juergbi svn gnome org
- To: svn-commits-list gnome org
- Subject: vala r2306 - in trunk: . vala
- Date: Fri, 9 Jan 2009 18:22:14 +0000 (UTC)
Author: juergbi
Date: Fri Jan 9 18:22:13 2009
New Revision: 2306
URL: http://svn.gnome.org/viewvc/vala?rev=2306&view=rev
Log:
2009-01-09 JÃrg Billeter <j bitron ch>
* vala/valaparser.vala:
Do not accept `ref' and `out' expressions outside of arguments,
fixes bug 548418
Modified:
trunk/ChangeLog
trunk/vala/valaparser.vala
Modified: trunk/vala/valaparser.vala
==============================================================================
--- trunk/vala/valaparser.vala (original)
+++ trunk/vala/valaparser.vala Fri Jan 9 18:22:13 2009
@@ -445,12 +445,26 @@
var list = new ArrayList<Expression> ();
if (current () != TokenType.CLOSE_PARENS) {
do {
- list.add (parse_expression ());
+ list.add (parse_argument ());
} while (accept (TokenType.COMMA));
}
return list;
}
+ Expression parse_argument () throws ParseError {
+ var begin = get_location ();
+
+ if (accept (TokenType.REF)) {
+ var inner = parse_expression ();
+ return new UnaryExpression (UnaryOperator.REF, inner, get_src (begin));
+ } else if (accept (TokenType.OUT)) {
+ var inner = parse_expression ();
+ return new UnaryExpression (UnaryOperator.OUT, inner, get_src (begin));
+ } else {
+ return parse_expression ();
+ }
+ }
+
Expression parse_primary_expression () throws ParseError {
var begin = get_location ();
@@ -777,8 +791,6 @@
case TokenType.TILDE: return UnaryOperator.BITWISE_COMPLEMENT;
case TokenType.OP_INC: return UnaryOperator.INCREMENT;
case TokenType.OP_DEC: return UnaryOperator.DECREMENT;
- case TokenType.REF: return UnaryOperator.REF;
- case TokenType.OUT: return UnaryOperator.OUT;
default: return UnaryOperator.NONE;
}
}
@@ -2092,7 +2104,7 @@
var initializer = new InitializerList (get_src (begin));
if (current () != TokenType.CLOSE_BRACE) {
do {
- var init = parse_expression ();
+ var init = parse_argument ();
initializer.append (init);
} while (accept (TokenType.COMMA));
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]