]> git.ipfire.org Git - thirdparty/vala.git/commitdiff
Support multiple variable declarators in for initializer
authorJürg Billeter <j@bitron.ch>
Sat, 9 Jan 2010 11:34:53 +0000 (12:34 +0100)
committerJürg Billeter <j@bitron.ch>
Sat, 9 Jan 2010 11:34:53 +0000 (12:34 +0100)
Fixes bug 601350.

vala/valaparser.vala

index ea5df106c1b98811dea9037e084c3ee8304d8aab..6542bfe4e1a482f381d12a8b1c5e98930242ec8b 100644 (file)
@@ -1634,18 +1634,12 @@ public class Vala.Parser : CodeVisitor {
                                do {
                                        initializer_list.add (parse_statement_expression ());
                                } while (accept (TokenType.COMMA));
+                               expect (TokenType.SEMICOLON);
                        } else {
+                               // variable declaration in initializer
                                block = new Block (get_src (begin));
-                               DataType variable_type;
-                               if (accept (TokenType.VAR)) {
-                                       variable_type = null;
-                               } else {
-                                       variable_type = parse_type ();
-                               }
-                               var local = parse_local_variable (variable_type);
-                               block.add_statement (new DeclarationStatement (local, local.source_reference));
+                               parse_local_variable_declarations (block);
                        }
-                       expect (TokenType.SEMICOLON);
                }
                Expression condition = null;
                if (current () != TokenType.SEMICOLON) {