vala r2257 - in trunk: . vala
- From: juergbi svn gnome org
- To: svn-commits-list gnome org
- Subject: vala r2257 - in trunk: . vala
- Date: Sat, 3 Jan 2009 17:18:09 +0000 (UTC)
Author: juergbi
Date: Sat Jan 3 17:18:09 2009
New Revision: 2257
URL: http://svn.gnome.org/viewvc/vala?rev=2257&view=rev
Log:
2009-01-03 JÃrg Billeter <j bitron ch>
* vala/valacodewriter.vala:
Support writing array creation expressions and initializer lists
Modified:
trunk/ChangeLog
trunk/vala/valacodewriter.vala
Modified: trunk/vala/valacodewriter.vala
==============================================================================
--- trunk/vala/valacodewriter.vala (original)
+++ trunk/vala/valacodewriter.vala Sat Jan 3 17:18:09 2009
@@ -1,6 +1,7 @@
/* valacodewriter.vala
*
- * Copyright (C) 2006-2008 JÃrg Billeter, Raffaele Sandrini
+ * Copyright (C) 2006-2009 JÃrg Billeter
+ * Copyright (C) 2006-2008 Raffaele Sandrini
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
@@ -1043,6 +1044,19 @@
}
public override void visit_initializer_list (InitializerList list) {
+ write_string ("{");
+
+ bool first = true;
+ foreach (Expression initializer in list.get_initializers ()) {
+ if (!first) {
+ write_string (", ");
+ } else {
+ write_string (" ");
+ }
+ first = false;
+ initializer.accept (this);
+ }
+ write_string (" }");
}
public override void visit_expression_statement (ExpressionStatement stmt) {
@@ -1218,6 +1232,26 @@
}
public override void visit_array_creation_expression (ArrayCreationExpression expr) {
+ write_string ("new ");
+ write_type (expr.element_type);
+ write_string ("[");
+
+ bool first = true;
+ foreach (Expression size in expr.get_sizes ()) {
+ if (!first) {
+ write_string (", ");
+ }
+ first = false;
+
+ size.accept (this);
+ }
+
+ write_string ("]");
+
+ if (expr.initializer_list != null) {
+ write_string (" ");
+ expr.initializer_list.accept (this);
+ }
}
public override void visit_boolean_literal (BooleanLiteral lit) {
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]