vala r1471 - in trunk: . vala
- From: juergbi svn gnome org
- To: svn-commits-list gnome org
- Subject: vala r1471 - in trunk: . vala
- Date: Wed, 28 May 2008 20:20:05 +0000 (UTC)
Author: juergbi
Date: Wed May 28 20:20:04 2008
New Revision: 1471
URL: http://svn.gnome.org/viewvc/vala?rev=1471&view=rev
Log:
2008-05-28 Juerg Billeter <j bitron ch>
* vala/valaparser.vala:
Allow short-hand form to initialize arrays, fixes bug 515407
Modified:
trunk/ChangeLog
trunk/vala/valaparser.vala
Modified: trunk/vala/valaparser.vala
==============================================================================
--- trunk/vala/valaparser.vala (original)
+++ trunk/vala/valaparser.vala Wed May 28 20:20:04 2008
@@ -1373,6 +1373,15 @@
Expression initializer = null;
if (accept (TokenType.ASSIGN)) {
initializer = parse_variable_initializer ();
+
+ // transform shorthand form
+ // int[] array = { 42 };
+ // into
+ // int[] array = new int[] { 42 };
+ var array_type = variable_type as ArrayType;
+ if (array_type != null && initializer is InitializerList) {
+ initializer = new ArrayCreationExpression (array_type.element_type.copy (), array_type.rank, (InitializerList) initializer, initializer.source_reference);
+ }
}
return new LocalVariable (variable_type, id, initializer, get_src_com (begin));
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]