vala r1405 - in trunk: . tests vala
- From: juergbi svn gnome org
- To: svn-commits-list gnome org
- Subject: vala r1405 - in trunk: . tests vala
- Date: Fri, 23 May 2008 08:44:14 +0000 (UTC)
Author: juergbi
Date: Fri May 23 08:44:13 2008
New Revision: 1405
URL: http://svn.gnome.org/viewvc/vala?rev=1405&view=rev
Log:
2008-05-23 Juerg Billeter <j bitron ch>
* vala/valasemanticanalyzer.vala:
Allow invocation of void methods as initializer and iterator in
for statements, patch by Jared Moore, fixes bug 514801
* tests/Makefile.am:
* tests/statements-iteration.exp:
* tests/statements-iteration.vala:
Test void methods in for statements
Added:
trunk/tests/statements-iteration.exp
trunk/tests/statements-iteration.vala
Modified:
trunk/ChangeLog
trunk/tests/Makefile.am
trunk/vala/valasemanticanalyzer.vala
Modified: trunk/tests/Makefile.am
==============================================================================
--- trunk/tests/Makefile.am (original)
+++ trunk/tests/Makefile.am Fri May 23 08:44:13 2008
@@ -22,6 +22,7 @@
expressions-assignments.vala \
expressions-lambda.vala \
statements-selection.vala \
+ statements-iteration.vala \
statements-jump.vala \
namespaces.vala \
classes.vala \
@@ -59,6 +60,7 @@
expressions-assignments.exp \
expressions-lambda.exp \
statements-selection.exp \
+ statements-iteration.exp \
statements-jump.exp \
namespaces.exp \
classes.exp \
Added: trunk/tests/statements-iteration.exp
==============================================================================
Added: trunk/tests/statements-iteration.vala
==============================================================================
--- (empty file)
+++ trunk/tests/statements-iteration.vala Fri May 23 08:44:13 2008
@@ -0,0 +1,14 @@
+void void_method () {
+}
+
+// http://bugzilla.gnome.org/show_bug.cgi?id=514801
+void test_for_void_methods () {
+ for (void_method (); ; void_method ()) {
+ break;
+ }
+}
+
+void main () {
+ test_for_void_methods ();
+}
+
Modified: trunk/vala/valasemanticanalyzer.vala
==============================================================================
--- trunk/vala/valasemanticanalyzer.vala (original)
+++ trunk/vala/valasemanticanalyzer.vala Fri May 23 08:44:13 2008
@@ -1827,7 +1827,10 @@
if (ret_type is VoidType) {
// void return type
- if (!(expr.parent_node is ExpressionStatement)) {
+ if (!(expr.parent_node is ExpressionStatement)
+ && !(expr.parent_node is ForStatement)) {
+ // A void method invocation can be in the initializer or
+ // iterator of a for statement
expr.error = true;
Report.error (expr.source_reference, "invocation of void method not allowed as expression");
return;
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]