[vala/wip/gee: 103/103] Move to .foreach methods where it does not impact readability



commit daac5bd77f668ed3d49d0c8fc934807620629c78
Author: Maciej Piechotka <uzytkownik2 gmail com>
Date:   Wed Sep 21 12:28:39 2016 +0200

    Move to .foreach methods where it does not impact readability
    
    https://bugzilla.gnome.org/show_bug.cgi?id=704754

 ccode/valaccodeblock.vala                  |   13 +-
 ccode/valaccodecommaexpression.vala        |    5 +-
 ccode/valaccodedeclaration.vala            |   26 ++--
 ccode/valaccodeenum.vala                   |    5 +-
 ccode/valaccodeexpressionstatement.vala    |    5 +-
 ccode/valaccodefile.vala                   |    5 +-
 ccode/valaccodeforstatement.vala           |   10 +-
 ccode/valaccodefragment.vala               |   15 ++-
 ccode/valaccodefunction.vala               |   10 +-
 ccode/valaccodefunctioncall.vala           |    5 +-
 ccode/valaccodefunctiondeclarator.vala     |    5 +-
 ccode/valaccodeinitializerlist.vala        |    5 +-
 ccode/valaccodeoncesection.vala            |    5 +-
 ccode/valaccodestruct.vala                 |    5 +-
 codegen/valaccodearraymodule.vala          |    5 +-
 codegen/valaccodebasemodule.vala           |  197 ++++++++++++++++------------
 codegen/valaccodecompiler.vala             |   22 ++--
 codegen/valaccodecontrolflowmodule.vala    |   52 ++++----
 codegen/valaccodedelegatemodule.vala       |   17 ++-
 codegen/valaccodemethodcallmodule.vala     |   60 +++++----
 codegen/valaccodemethodmodule.vala         |   96 ++++++++------
 codegen/valaccodestructmodule.vala         |   12 +-
 codegen/valaclassregisterfunction.vala     |   14 +-
 codegen/valagasyncmodule.vala              |   35 +++--
 codegen/valagdbusclientmodule.vala         |   65 ++++++----
 codegen/valagdbusmodule.vala               |   46 ++++---
 codegen/valagdbusservermodule.vala         |   86 +++++++------
 codegen/valagerrormodule.vala              |   44 ++++---
 codegen/valagirwriter.vala                 |   75 +++++++----
 codegen/valagobjectmodule.vala             |   66 +++++-----
 codegen/valagsignalmodule.vala             |   35 +++--
 codegen/valagtkmodule.vala                 |   10 +-
 codegen/valagtypemodule.vala               |  153 +++++++++++++---------
 codegen/valagvariantmodule.vala            |   34 +++--
 codegen/valainterfaceregisterfunction.vala |    5 +-
 codegen/valatyperegisterfunction.vala      |    5 +-
 vala/valaarraycreationexpression.vala      |   20 ++-
 vala/valaassignment.vala                   |   15 ++-
 vala/valabaseaccess.vala                   |    5 +-
 vala/valablock.vala                        |   15 ++-
 vala/valaclass.vala                        |  192 ++++++++++++++++------------
 vala/valaclasstype.vala                    |    5 +-
 vala/valacodecontext.vala                  |    5 +-
 vala/valacodenode.vala                     |    5 +-
 vala/valacodewriter.vala                   |  132 +++++++++++--------
 vala/valaconstructor.vala                  |    5 +-
 vala/valacreationmethod.vala               |   50 ++++---
 vala/valadatatype.vala                     |   12 +-
 vala/valadeclarationstatement.vala         |    5 +-
 vala/valadelegate.vala                     |   53 ++++----
 vala/valadelegatetype.vala                 |   10 +-
 vala/valaelementaccess.vala                |   40 +++---
 vala/valaenum.vala                         |   30 +++--
 vala/valaerrordomain.vala                  |   20 ++-
 vala/valaflowanalyzer.vala                 |  175 ++++++++++++++----------
 vala/valaforeachstatement.vala             |    5 +-
 vala/valaforstatement.vala                 |   20 ++-
 vala/valagenieparser.vala                  |  140 ++++++++++++--------
 vala/valagirparser.vala                    |  177 +++++++++++++++----------
 vala/valainitializerlist.vala              |   45 +++----
 vala/valainterface.vala                    |  129 +++++++++++--------
 vala/valainterfacetype.vala                |    5 +-
 vala/valalambdaexpression.vala             |   17 ++-
 vala/valamarkupreader.vala                 |    4 +-
 vala/valamemberaccess.vala                 |   22 ++--
 vala/valamethod.vala                       |   95 ++++++++------
 vala/valamethodcall.vala                   |   87 +++++++-----
 vala/valamethodtype.vala                   |    7 +-
 vala/valanamespace.vala                    |  115 ++++++++++-------
 vala/valaobjectcreationexpression.vala     |   72 ++++++----
 vala/valaobjecttype.vala                   |    5 +-
 vala/valaobjecttypesymbol.vala             |    5 +-
 vala/valaparser.vala                       |  120 ++++++++++-------
 vala/valaproperty.vala                     |    9 +-
 vala/valapropertyaccessor.vala             |    5 +-
 vala/valasemanticanalyzer.vala             |   10 +-
 vala/valasignal.vala                       |   20 ++-
 vala/valasignaltype.vala                   |    5 +-
 vala/valasourcefile.vala                   |   15 ++-
 vala/valastatementlist.vala                |   10 +-
 vala/valastruct.vala                       |   72 ++++++-----
 vala/valastructvaluetype.vala              |    5 +-
 vala/valaswitchsection.vala                |   45 ++++---
 vala/valaswitchstatement.vala              |   15 ++-
 vala/valasymbolresolver.vala               |    5 +-
 vala/valatemplate.vala                     |    5 +-
 vala/valatrystatement.vala                 |   35 +++--
 vala/valatuple.vala                        |   10 +-
 vala/valaunresolvedtype.vala               |   15 ++-
 89 files changed, 1968 insertions(+), 1430 deletions(-)
---
diff --git a/ccode/valaccodeblock.vala b/ccode/valaccodeblock.vala
index 5c8f2c7..c642e6b 100644
--- a/ccode/valaccodeblock.vala
+++ b/ccode/valaccodeblock.vala
@@ -54,7 +54,7 @@ public class Vala.CCodeBlock : CCodeStatement {
                CCodeNode last_statement = null;
 
                writer.write_begin_block ();
-               foreach (CCodeNode statement in statements) {
+               statements.foreach ((statement) => {
                        statement.write_declaration (writer);
 
                        // determine last reachable statement
@@ -64,16 +64,15 @@ public class Vala.CCodeBlock : CCodeStatement {
                        || statement is CCodeContinueStatement || statement is CCodeBreakStatement) {
                                last_statement = statement;
                        }
-               }
+                       return true;
+               });
 
-               foreach (CCodeNode statement in statements) {
+               statements.foreach ((statement) => {
                        statement.write (writer);
 
                        // only output reachable code
-                       if (statement == last_statement) {
-                               break;
-                       }
-               }
+                       return statement != last_statement;
+               });
 
                writer.write_end_block ();
 
diff --git a/ccode/valaccodecommaexpression.vala b/ccode/valaccodecommaexpression.vala
index 6010428..643c14c 100644
--- a/ccode/valaccodecommaexpression.vala
+++ b/ccode/valaccodecommaexpression.vala
@@ -49,14 +49,15 @@ public class Vala.CCodeCommaExpression : CCodeExpression {
                bool first = true;
        
                writer.write_string ("(");
-               foreach (CCodeExpression expr in inner) {
+               inner.foreach ((expr) => {
                        if (!first) {
                                writer.write_string (", ");
                        } else {
                                first = false;
                        }
                        expr.write (writer);
-               }
+                       return true;
+               });
                writer.write_string (")");
        }
 }
diff --git a/ccode/valaccodedeclaration.vala b/ccode/valaccodedeclaration.vala
index 4d0fa74..3c02dd4 100644
--- a/ccode/valaccodedeclaration.vala
+++ b/ccode/valaccodedeclaration.vala
@@ -48,20 +48,18 @@ public class Vala.CCodeDeclaration : CCodeStatement {
        
        public override void write (CCodeWriter writer) {
                if ((modifiers & (CCodeModifiers.STATIC | CCodeModifiers.INTERNAL | CCodeModifiers.EXTERN)) 
== 0) {
-                       foreach (CCodeDeclarator decl in declarators) {
+                       declarators.foreach ((decl) => {
                                decl.write_initialization (writer);
-                       }
+                               return true;
+                       });
                }
        }
 
        private bool has_initializer () {
-               foreach (CCodeDeclarator decl in declarators) {
-                       var var_decl = decl as CCodeVariableDeclarator;
-                       if (var_decl != null && var_decl.initializer == null) {
-                               return false;
-                       }
-               }
-               return true;
+               return declarators.foreach ((decl) => {
+                       unowned CCodeVariableDeclarator var_decl = decl as CCodeVariableDeclarator;
+                       return !(var_decl != null && var_decl.initializer == null);
+               });
        }
 
        public override void write_declaration (CCodeWriter writer) {
@@ -87,14 +85,15 @@ public class Vala.CCodeDeclaration : CCodeStatement {
                        writer.write_string (" ");
 
                        bool first = true;
-                       foreach (CCodeDeclarator decl in declarators) {
+                       declarators.foreach ((decl) => {
                                if (!first) {
                                        writer.write_string (", ");
                                } else {
                                        first = false;
                                }
                                decl.write (writer);
-                       }
+                               return true;
+                       });
 
                        if (CCodeModifiers.DEPRECATED in modifiers) {
                                writer.write_string (" G_GNUC_DEPRECATED");
@@ -116,14 +115,15 @@ public class Vala.CCodeDeclaration : CCodeStatement {
                writer.write_string (" ");
        
                bool first = true;
-               foreach (CCodeDeclarator decl in declarators) {
+               declarators.foreach ((decl) => {
                        if (!first) {
                                writer.write_string (", ");
                        } else {
                                first = false;
                        }
                        decl.write_declaration (writer);
-               }
+                       return true;
+               });
 
                if (CCodeModifiers.DEPRECATED in modifiers) {
                        writer.write_string (" G_GNUC_DEPRECATED");
diff --git a/ccode/valaccodeenum.vala b/ccode/valaccodeenum.vala
index f2a3788..4fba47e 100644
--- a/ccode/valaccodeenum.vala
+++ b/ccode/valaccodeenum.vala
@@ -53,7 +53,7 @@ public class Vala.CCodeEnum : CCodeNode {
                writer.write_string ("enum ");
                writer.write_begin_block ();
                bool first = true;
-               foreach (CCodeEnumValue value in values) {
+               values.foreach ((value) => {
                        if (!first) {
                                writer.write_string (",");
                                writer.write_newline ();
@@ -61,7 +61,8 @@ public class Vala.CCodeEnum : CCodeNode {
                        writer.write_indent ();
                        value.write (writer);
                        first = false;
-               }
+                       return true;
+               });
                if (!first) {
                        writer.write_newline ();
                }
diff --git a/ccode/valaccodeexpressionstatement.vala b/ccode/valaccodeexpressionstatement.vala
index 57b2b2d..fa2e855 100644
--- a/ccode/valaccodeexpressionstatement.vala
+++ b/ccode/valaccodeexpressionstatement.vala
@@ -41,9 +41,10 @@ public class Vala.CCodeExpressionStatement : CCodeStatement {
                        // to improve code readability
                        var ccomma = expression as CCodeCommaExpression;
 
-                       foreach (CCodeExpression expr in ccomma.get_inner ()) {
+                       ccomma.get_inner ().foreach ((expr) => {
                                write_expression (writer, expr);
-                       }
+                               return true;
+                       });
                } else if (expression is CCodeParenthesizedExpression) {
                        var cpar = expression as CCodeParenthesizedExpression;
 
diff --git a/ccode/valaccodefile.vala b/ccode/valaccodefile.vala
index 0b256e5..a191ef3 100644
--- a/ccode/valaccodefile.vala
+++ b/ccode/valaccodefile.vala
@@ -90,7 +90,7 @@ public class Vala.CCodeFile {
        }
 
        void get_symbols_from_fragment (List<string> symbols, CCodeFragment fragment) {
-               foreach (CCodeNode node in fragment.get_children ()) {
+               fragment.get_children ().foreach ((node) => {
                        if (node is CCodeFragment) {
                                get_symbols_from_fragment (symbols, (CCodeFragment) node);
                        } else {
@@ -99,7 +99,8 @@ public class Vala.CCodeFile {
                                        symbols.add (func.name);
                                }
                        }
-               }
+                       return true;
+               });
        }
 
        static string get_define_for_filename (string filename) {
diff --git a/ccode/valaccodeforstatement.vala b/ccode/valaccodeforstatement.vala
index c4d14be..9d7796b 100644
--- a/ccode/valaccodeforstatement.vala
+++ b/ccode/valaccodeforstatement.vala
@@ -69,7 +69,7 @@ public class Vala.CCodeForStatement : CCodeStatement {
                writer.write_string ("for (");
                
                first = true;
-               foreach (CCodeExpression init_expr in initializer) {
+               initializer.foreach ((init_expr) => {
                        if (!first) {
                                writer.write_string (", ");
                        } else {
@@ -78,7 +78,8 @@ public class Vala.CCodeForStatement : CCodeStatement {
                        if (init_expr != null) {
                                init_expr.write (writer);
                        }
-               }
+                       return true;
+               });
 
                writer.write_string ("; ");
                if (condition != null) {
@@ -87,7 +88,7 @@ public class Vala.CCodeForStatement : CCodeStatement {
                writer.write_string ("; ");
                
                first = true;
-               foreach (CCodeExpression it_expr in iterator) {
+               iterator.foreach ((it_expr) => {
                        if (!first) {
                                writer.write_string (", ");
                        } else {
@@ -96,7 +97,8 @@ public class Vala.CCodeForStatement : CCodeStatement {
                        if (it_expr != null) {
                                it_expr.write (writer);
                        }
-               }
+                       return true;
+               });
 
                writer.write_string (")");
                body.write (writer);
diff --git a/ccode/valaccodefragment.vala b/ccode/valaccodefragment.vala
index 0e229ff..3d2d792 100644
--- a/ccode/valaccodefragment.vala
+++ b/ccode/valaccodefragment.vala
@@ -47,20 +47,23 @@ public class Vala.CCodeFragment : CCodeNode {
        }
 
        public override void write (CCodeWriter writer) {
-               foreach (CCodeNode node in children) {
+               children.foreach ((node) => {
                        node.write (writer);
-               }
+                       return true;
+               });
        }
 
        public override void write_declaration (CCodeWriter writer) {
-               foreach (CCodeNode node in children) {
+               children.foreach ((node) => {
                        node.write_declaration (writer);
-               }
+                       return true;
+               });
        }
 
        public override void write_combined (CCodeWriter writer) {
-               foreach (CCodeNode node in children) {
+               children.foreach ((node) => {
                        node.write_combined (writer);
-               }
+                       return true;
+               });
        }
 }
diff --git a/ccode/valaccodefunction.vala b/ccode/valaccodefunction.vala
index 394fdac..9db05a0 100644
--- a/ccode/valaccodefunction.vala
+++ b/ccode/valaccodefunction.vala
@@ -93,9 +93,10 @@ public class Vala.CCodeFunction : CCodeNode {
                /* no deep copy for lists available yet
                 * func.parameters = parameters.copy ();
                 */
-               foreach (CCodeParameter param in parameters) {
+               parameters.foreach ((param) => {
                        func.parameters.add (param);
-               }
+                       return true;
+               });
                
                func.is_declaration = is_declaration;
                func.block = block;
@@ -122,7 +123,7 @@ public class Vala.CCodeFunction : CCodeNode {
                int i = 0;
                int format_arg_index = -1;
                int args_index = -1;
-               foreach (CCodeParameter param in parameters) {
+               parameters.foreach ((param) => {
                        if (i > 0) {
                                writer.write_string (", ");
                        }
@@ -136,7 +137,8 @@ public class Vala.CCodeFunction : CCodeNode {
                                format_arg_index = i - 1;
                        }
                        i++;
-               }
+                       return true;
+               });
                if (i == 0) {
                        writer.write_string ("void");
                }
diff --git a/ccode/valaccodefunctioncall.vala b/ccode/valaccodefunctioncall.vala
index e9e7d14..76906ff 100644
--- a/ccode/valaccodefunctioncall.vala
+++ b/ccode/valaccodefunctioncall.vala
@@ -64,7 +64,7 @@ public class Vala.CCodeFunctionCall : CCodeExpression {
                writer.write_string (" (");
 
                bool first = true;
-               foreach (CCodeExpression expr in arguments) {
+               arguments.foreach ((expr) => {
                        if (!first) {
                                writer.write_string (", ");
                        } else {
@@ -74,7 +74,8 @@ public class Vala.CCodeFunctionCall : CCodeExpression {
                        if (expr != null) {
                                expr.write (writer);
                        }
-               }
+                       return true;
+               });
 
                writer.write_string (")");
        }
diff --git a/ccode/valaccodefunctiondeclarator.vala b/ccode/valaccodefunctiondeclarator.vala
index b195f5a..949bd4b 100644
--- a/ccode/valaccodefunctiondeclarator.vala
+++ b/ccode/valaccodefunctiondeclarator.vala
@@ -59,7 +59,7 @@ public class Vala.CCodeFunctionDeclarator : CCodeDeclarator {
                int i = 0;
                int format_arg_index = -1;
                int args_index = -1;
-               foreach (CCodeParameter param in parameters) {
+               parameters.foreach ((param) => {
                        if (i > 0) {
                                writer.write_string (", ");
                        }
@@ -73,7 +73,8 @@ public class Vala.CCodeFunctionDeclarator : CCodeDeclarator {
                                format_arg_index = i - 1;
                        }
                        i++;
-               }
+                       return true;
+               });
                
                writer.write_string (")");
 
diff --git a/ccode/valaccodeinitializerlist.vala b/ccode/valaccodeinitializerlist.vala
index 26cb56e..a26603b 100644
--- a/ccode/valaccodeinitializerlist.vala
+++ b/ccode/valaccodeinitializerlist.vala
@@ -41,7 +41,7 @@ public class Vala.CCodeInitializerList : CCodeExpression {
                writer.write_string ("{");
 
                bool first = true;
-               foreach (CCodeExpression expr in initializers) {
+               initializers.foreach ((expr) => {
                        if (!first) {
                                writer.write_string (", ");
                        } else {
@@ -51,7 +51,8 @@ public class Vala.CCodeInitializerList : CCodeExpression {
                        if (expr != null) {
                                expr.write (writer);
                        }
-               }
+                       return true;
+               });
 
                writer.write_string ("}");
        }
diff --git a/ccode/valaccodeoncesection.vala b/ccode/valaccodeoncesection.vala
index 10aa861..8223bcb 100644
--- a/ccode/valaccodeoncesection.vala
+++ b/ccode/valaccodeoncesection.vala
@@ -43,9 +43,10 @@ public class Vala.CCodeOnceSection : CCodeFragment {
                writer.write_string ("#define ");
                writer.write_string (define);
                writer.write_newline ();
-               foreach (CCodeNode node in get_children ()) {
+               get_children ().foreach ((node) => {
                        node.write_combined (writer);
-               }
+                       return true;
+               });
                writer.write_indent ();
                writer.write_string ("#endif");
                writer.write_newline ();
diff --git a/ccode/valaccodestruct.vala b/ccode/valaccodestruct.vala
index fce7fcb..3da5aa2 100644
--- a/ccode/valaccodestruct.vala
+++ b/ccode/valaccodestruct.vala
@@ -65,9 +65,10 @@ public class Vala.CCodeStruct : CCodeNode {
                writer.write_string ("struct ");
                writer.write_string (name);
                writer.write_begin_block ();
-               foreach (CCodeDeclaration decl in declarations) {
+               declarations.foreach ((decl) => {
                        decl.write_declaration (writer);
-               }
+                       return true;
+               });
 
                writer.write_end_block ();
                if (CCodeModifiers.DEPRECATED in modifiers) {
diff --git a/codegen/valaccodearraymodule.vala b/codegen/valaccodearraymodule.vala
index 2b78bbc..d87140d 100644
--- a/codegen/valaccodearraymodule.vala
+++ b/codegen/valaccodearraymodule.vala
@@ -63,7 +63,7 @@ public class Vala.CCodeArrayModule : CCodeMethodCallModule {
                CCodeExpression cexpr = null;
 
                // iterate over each dimension
-               foreach (Expression size in expr.get_sizes ()) {
+               expr.get_sizes ().foreach ((size) => {
                        CCodeExpression csize = get_cvalue (size);
                        append_array_length (expr, csize);
 
@@ -73,7 +73,8 @@ public class Vala.CCodeArrayModule : CCodeMethodCallModule {
                        } else {
                                cexpr = new CCodeBinaryExpression (CCodeBinaryOperator.MUL, cexpr, csize);
                        }
-               }
+                       return true;
+               });
                
                // add extra item to have array NULL-terminated for all reference types
                if (expr.element_type.data_type != null && expr.element_type.data_type.is_reference_type ()) {
diff --git a/codegen/valaccodebasemodule.vala b/codegen/valaccodebasemodule.vala
index 4943b60..cb40a05 100644
--- a/codegen/valaccodebasemodule.vala
+++ b/codegen/valaccodebasemodule.vala
@@ -486,13 +486,13 @@ public abstract class Vala.CCodeBaseModule : CodeGenerator {
                regex_type = new ObjectType ((Class) root_symbol.scope.lookup ("GLib").scope.lookup 
("Regex"));
 
                if (context.module_init_method != null) {
-                       foreach (Parameter parameter in context.module_init_method.get_parameters ()) {
+                       in_plugin = !context.module_init_method.get_parameters ().foreach ((parameter) => {
                                if (parameter.variable_type.data_type == type_module_type) {
-                                       in_plugin = true;
                                        module_init_param_name = parameter.name;
-                                       break;
+                                       return false;
                                }
-                       }
+                               return true;;
+                       });
                        if (!in_plugin) {
                                Report.error (context.module_init_method.source_reference, "[ModuleInit] 
requires a parameter of type `GLib.TypeModule'");
                        }
@@ -512,12 +512,13 @@ public abstract class Vala.CCodeBaseModule : CodeGenerator {
 
                /* we're only interested in non-pkg source files */
                var source_files = context.get_source_files ();
-               foreach (SourceFile file in source_files) {
+               source_files.foreach ((file) => {
                        if (file.file_type == SourceFileType.SOURCE ||
                            (context.header_filename != null && file.file_type == SourceFileType.FAST)) {
                                file.accept (this);
                        }
-               }
+                       return true;
+               });
 
                // generate symbols file for public API
                if (context.symbols_filename != null) {
@@ -527,10 +528,11 @@ public abstract class Vala.CCodeBaseModule : CodeGenerator {
                                return;
                        }
 
-                       foreach (string symbol in header_file.get_symbols ()) {
+                       header_file.get_symbols ().foreach ((symbol) => {
                                stream.puts (symbol);
                                stream.putc ('\n');
-                       }
+                               return true;
+                       });
 
                        stream = null;
                }
@@ -774,10 +776,11 @@ public abstract class Vala.CCodeBaseModule : CodeGenerator {
 
                var comments = source_file.get_comments();
                if (comments != null) {
-                       foreach (Comment comment in comments) {
+                       comments.foreach ((comment) => {
                                var ccomment = new CCodeComment (comment.content);
                                cfile.add_comment (ccomment);
-                       }
+                               return true;
+                       });
                }
 
                if (!cfile.store (source_file.get_csource_filename (), source_file.filename, 
context.version_header, context.debug)) {
@@ -797,7 +800,7 @@ public abstract class Vala.CCodeBaseModule : CodeGenerator {
                cenum.modifiers |= (en.version.deprecated ? CCodeModifiers.DEPRECATED : 0);
 
                int flag_shift = 0;
-               foreach (EnumValue ev in en.get_values ()) {
+               en.get_values ().foreach ((ev) => {
                        CCodeEnumValue c_ev;
                        if (ev.value == null) {
                                c_ev = new CCodeEnumValue (get_ccode_name (ev));
@@ -811,7 +814,8 @@ public abstract class Vala.CCodeBaseModule : CodeGenerator {
                        }
                        c_ev.modifiers |= (ev.version.deprecated ? CCodeModifiers.DEPRECATED : 0);
                        cenum.add_value (c_ev);
-               }
+                       return true;
+               });
 
                decl_space.add_type_definition (cenum);
                decl_space.add_type_definition (new CCodeNewline ());
@@ -1130,9 +1134,10 @@ public abstract class Vala.CCodeBaseModule : CodeGenerator {
                                        }
                                }
 
-                               foreach (var value in temp_ref_values) {
+                               temp_ref_values.foreach ((value) => {
                                        ccode.add_expression (destroy_value (value));
-                               }
+                                       return true;
+                               });
 
                                temp_ref_values.clear ();
 
@@ -1168,9 +1173,10 @@ public abstract class Vala.CCodeBaseModule : CodeGenerator {
 
                                ccode.add_assignment (lhs, rhs);
 
-                               foreach (var value in temp_ref_values) {
+                               temp_ref_values.foreach ((value) => {
                                        ccode.add_expression (destroy_value (value));
-                               }
+                                       return true;
+                               });
 
                                temp_ref_values.clear ();
 
@@ -1446,9 +1452,10 @@ public abstract class Vala.CCodeBaseModule : CodeGenerator {
                        generate_type_declaration (pointer_type.base_type, decl_space);
                }
 
-               foreach (DataType type_arg in type.get_type_arguments ()) {
+               type.get_type_arguments ().foreach ((type_arg) => {
                        generate_type_declaration (type_arg, decl_space);
-               }
+                       return true;
+               });
        }
 
        public virtual void generate_class_struct_declaration (Class cl, CCodeFile decl_space) {
@@ -1917,7 +1924,7 @@ public abstract class Vala.CCodeBaseModule : CodeGenerator {
 
                                if (current_method != null) {
                                        // allow capturing generic type parameters
-                                       foreach (var type_param in current_method.get_type_parameters ()) {
+                                       current_method.get_type_parameters ().foreach ((type_param) => {
                                                string func_name;
 
                                                func_name = "%s_type".printf (type_param.name.down ());
@@ -1928,10 +1935,11 @@ public abstract class Vala.CCodeBaseModule : CodeGenerator {
 
                                                func_name = "%s_destroy_func".printf (type_param.name.down 
());
                                                data.add_field ("GDestroyNotify", func_name);
-                                       }
+                                               return true;
+                                       });
                                }
                        }
-                       foreach (var local in local_vars) {
+                       local_vars.foreach ((local) => {
                                if (local.captured) {
                                        generate_type_declaration (local.variable_type, cfile);
 
@@ -1950,7 +1958,8 @@ public abstract class Vala.CCodeBaseModule : CodeGenerator {
                                                }
                                        }
                                }
-                       }
+                               return true;
+                       });
 
                        var data_alloc = new CCodeFunctionCall (new CCodeIdentifier ("g_slice_new0"));
                        data_alloc.add_argument (new CCodeIdentifier (struct_name));
@@ -1990,12 +1999,13 @@ public abstract class Vala.CCodeBaseModule : CodeGenerator {
                                if (current_method != null) {
                                        // allow capturing generic type parameters
                                        var suffices = new string[] {"type", "dup_func", "destroy_func"};
-                                       foreach (var type_param in current_method.get_type_parameters ()) {
+                                       current_method.get_type_parameters ().foreach ((type_param) => {
                                                foreach (string suffix in suffices) {
                                                        string func_name = "%s_%s".printf 
(type_param.name.down (), suffix);
                                                        ccode.add_assignment (new CCodeMemberAccess.pointer 
(get_variable_cexpression ("_data%d_".printf (block_id)), func_name), get_variable_cexpression (func_name));
                                                }
-                                       }
+                                               return true;
+                                       });
                                }
                        }
 
@@ -2003,11 +2013,12 @@ public abstract class Vala.CCodeBaseModule : CodeGenerator {
                                var m = (Method) b.parent_symbol;
 
                                // parameters are captured with the top-level block of the method
-                               foreach (var param in m.get_parameters ()) {
+                               m.get_parameters ().foreach ((param) => {
                                        if (param.captured) {
                                                capture_parameter (param, data, block_id);
                                        }
-                               }
+                                       return true;
+                               });
 
                                if (m.coroutine) {
                                        // capture async data to allow invoking callback from inside closure
@@ -2081,7 +2092,7 @@ public abstract class Vala.CCodeBaseModule : CodeGenerator {
 
                        if (current_method != null) {
                                // assign captured generic type parameters
-                               foreach (var type_param in current_method.get_type_parameters ()) {
+                               current_method.get_type_parameters ().foreach ((type_param) => {
                                        string func_name;
 
                                        func_name = "%s_type".printf (type_param.name.down ());
@@ -2095,7 +2106,8 @@ public abstract class Vala.CCodeBaseModule : CodeGenerator {
                                        func_name = "%s_destroy_func".printf (type_param.name.down ());
                                        ccode.add_declaration ("GDestroyNotify", new CCodeVariableDeclarator 
(func_name));
                                        ccode.add_assignment (new CCodeIdentifier (func_name), new 
CCodeMemberAccess.pointer (outer_block, func_name));
-                               }
+                                       return true;
+                               });
                        }
 
                        // free in reverse order
@@ -2122,7 +2134,7 @@ public abstract class Vala.CCodeBaseModule : CodeGenerator {
                                var m = (Method) b.parent_symbol;
 
                                // parameters are captured with the top-level block of the method
-                               foreach (var param in m.get_parameters ()) {
+                               m.get_parameters ().foreach ((param) => {
                                        if (param.captured) {
                                                var param_type = param.variable_type.copy ();
                                                if (!param_type.value_owned) {
@@ -2143,7 +2155,8 @@ public abstract class Vala.CCodeBaseModule : CodeGenerator {
                                                        }
                                                }
                                        }
-                               }
+                                       return true;
+                               });
                        } else if (b.parent_symbol is PropertyAccessor) {
                                var acc = (PropertyAccessor) b.parent_symbol;
 
@@ -2194,11 +2207,12 @@ public abstract class Vala.CCodeBaseModule : CodeGenerator {
                        cfile.add_function (unref_fun);
                }
 
-               foreach (Statement stmt in b.get_statements ()) {
+               b.get_statements ().foreach ((stmt) => {
                        push_line (stmt.source_reference);
                        stmt.emit (this);
                        pop_line ();
-               }
+                       return true;
+               });
 
                // free in reverse order
                for (int i = local_vars.size - 1; i >= 0; i--) {
@@ -2211,17 +2225,19 @@ public abstract class Vala.CCodeBaseModule : CodeGenerator {
 
                if (b.parent_symbol is Method) {
                        var m = (Method) b.parent_symbol;
-                       foreach (Parameter param in m.get_parameters ()) {
+                       m.get_parameters ().foreach ((param) => {
                                if (!param.captured && !param.ellipsis && requires_destroy 
(param.variable_type) && param.direction == ParameterDirection.IN) {
                                        ccode.add_expression (destroy_parameter (param));
                                } else if (param.direction == ParameterDirection.OUT && !m.coroutine) {
                                        return_out_parameter (param);
                                }
-                       }
+                               return true;
+                       });
                        // check postconditions
-                       foreach (var postcondition in m.get_postconditions ()) {
+                       m.get_postconditions ().foreach ((postcondition) => {
                                create_postcondition_statement (postcondition);
-                       }
+                               return true;
+                       });
                } else if (b.parent_symbol is PropertyAccessor) {
                        var acc = (PropertyAccessor) b.parent_symbol;
                        if (acc.value_parameter != null && !acc.value_parameter.captured && requires_destroy 
(acc.value_parameter.variable_type)) {
@@ -2507,7 +2523,7 @@ public abstract class Vala.CCodeBaseModule : CodeGenerator {
                                var clist = new CCodeInitializerList ();
 
                                var field_it = st.get_fields ().iterator ();
-                               foreach (Expression expr in list.get_initializers ()) {
+                               list.get_initializers ().foreach ((expr) => {
                                        Field field = null;
                                        while (field == null) {
                                                field_it.next ();
@@ -2533,7 +2549,8 @@ public abstract class Vala.CCodeBaseModule : CodeGenerator {
                                                        clist.append (get_array_length_cvalue 
(expr.target_value, dim));
                                                }
                                        }
-                               }
+                                       return true;
+                               });
 
                                set_cvalue (list, clist);
                        } else {
@@ -2541,7 +2558,7 @@ public abstract class Vala.CCodeBaseModule : CodeGenerator {
                                var instance = create_temp_value (list.value_type, true, list);
 
                                var field_it = st.get_fields ().iterator ();
-                               foreach (Expression expr in list.get_initializers ()) {
+                               list.get_initializers ().foreach ((expr) => {
                                        Field field = null;
                                        while (field == null) {
                                                field_it.next ();
@@ -2553,15 +2570,17 @@ public abstract class Vala.CCodeBaseModule : CodeGenerator {
                                        }
 
                                        store_field (field, instance, expr.target_value);
-                               }
+                                       return true;
+                               });
 
                                list.target_value = instance;
                        }
                } else {
                        var clist = new CCodeInitializerList ();
-                       foreach (Expression expr in list.get_initializers ()) {
+                       list.get_initializers ().foreach ((expr) => {
                                clist.append (get_cvalue (expr));
-                       }
+                               return true;
+                       });
                        set_cvalue (list, clist);
                }
        }
@@ -2794,10 +2813,10 @@ public abstract class Vala.CCodeBaseModule : CodeGenerator {
                }
 
                bool has_instance_fields = false;
-               foreach (Field f in st.get_fields ()) {
+               st.get_fields ().foreach ((f) => {
                        if (f.binding != MemberBinding.INSTANCE) {
                                // we only compare instance fields
-                               continue;
+                               return true;
                        }
 
                        has_instance_fields = true;
@@ -2827,7 +2846,8 @@ public abstract class Vala.CCodeBaseModule : CodeGenerator {
                        ccode.open_if (cexp);
                        ccode.add_return (new CCodeConstant ("FALSE"));
                        ccode.close ();
-               }
+                       return true;
+               });
 
                if (!has_instance_fields) {
                        // either opaque structure or simple type
@@ -3106,12 +3126,13 @@ public abstract class Vala.CCodeBaseModule : CodeGenerator {
                        bool elements_require_free = false;
                        CCodeExpression element_destroy_func_expression = null;
 
-                       foreach (DataType type_arg in type.get_type_arguments ()) {
+                       type.get_type_arguments ().foreach ((type_arg) => {
                                elements_require_free = requires_destroy (type_arg);
                                if (elements_require_free) {
                                        element_destroy_func_expression = get_destroy0_func_expression 
(type_arg);
                                }
-                       }
+                               return true;
+                       });
                        
                        if (elements_require_free && element_destroy_func_expression is CCodeIdentifier) {
                                return new CCodeIdentifier (generate_collection_free_wrapper (type, 
(CCodeIdentifier) element_destroy_func_expression));
@@ -3465,9 +3486,10 @@ public abstract class Vala.CCodeBaseModule : CodeGenerator {
                        expr.target_value = store_temp_value (expr.target_value, expr);
                }
 
-               foreach (var value in temp_ref_values) {
+               temp_ref_values.foreach ((value) => {
                        ccode.add_expression (destroy_value (value));
-               }
+                       return true;
+               });
 
                temp_ref_values.clear ();
        }
@@ -3513,9 +3535,10 @@ public abstract class Vala.CCodeBaseModule : CodeGenerator {
 
                /* free temporary objects and handle errors */
 
-               foreach (var value in temp_ref_values) {
+               temp_ref_values.foreach ((value) => {
                        ccode.add_expression (destroy_value (value));
-               }
+                       return true;
+               });
 
                if (stmt.tree_can_fail && stmt.expression.tree_can_fail) {
                        // simple case, no node breakdown necessary
@@ -3577,11 +3600,12 @@ public abstract class Vala.CCodeBaseModule : CodeGenerator {
        }
 
        private void append_param_free (Method m) {
-               foreach (Parameter param in m.get_parameters ()) {
+               m.get_parameters ().foreach ((param) => {
                        if (!param.captured && !param.ellipsis && requires_destroy (param.variable_type) && 
param.direction == ParameterDirection.IN) {
                                ccode.add_expression (destroy_parameter (param));
                        }
-               }
+                       return true;
+               });
        }
 
        public bool variable_accessible_in_finally (LocalVariable local) {
@@ -3713,21 +3737,21 @@ public abstract class Vala.CCodeBaseModule : CodeGenerator {
 
                if (current_method != null) {
                        // check postconditions
-                       foreach (Expression postcondition in current_method.get_postconditions ()) {
+                       current_method.get_postconditions ().foreach ((postcondition) => {
                                create_postcondition_statement (postcondition);
-                       }
+                               return true;
+                       });
                }
 
                if (current_method != null && !current_method.coroutine) {
                        // assign values to output parameters if they are not NULL
                        // otherwise, free the value if necessary
-                       foreach (var param in current_method.get_parameters ()) {
-                               if (param.direction != ParameterDirection.OUT) {
-                                       continue;
+                       current_method.get_parameters ().foreach ((param) => {
+                               if (param.direction == ParameterDirection.OUT) {
+                                       return_out_parameter (param);
                                }
-
-                               return_out_parameter (param);
-                       }
+                               return true;
+                       });
                }
 
                // TODO: don't duplicate the code in CCodeMethodModule, we do this right now because it needs 
to be before return
@@ -4421,10 +4445,11 @@ public abstract class Vala.CCodeBaseModule : CodeGenerator {
                                }
                        }
                }
-               foreach (var type_arg in type.get_type_arguments ()) {
+               type.get_type_arguments ().foreach ((type_arg) => {
                        check_type (type_arg);
                        check_type_argument (type_arg);
-               }
+                       return true;
+               });
        }
 
        void check_type_argument (DataType type_arg) {
@@ -4579,12 +4604,13 @@ public abstract class Vala.CCodeBaseModule : CodeGenerator {
                                        } else {
                                                Parameter last_param = null;
                                                // FIXME: this doesn't take into account exception handling 
parameters
-                                               foreach (var param in current_method.get_parameters ()) {
+                                               current_method.get_parameters ().foreach ((param) => {
                                                        if (param.ellipsis) {
-                                                               break;
+                                                               return false;
                                                        }
                                                        last_param = param;
-                                               }
+                                                       return true;
+                                               });
                                                int nParams = ccode.get_parameter_count ();
                                                if (nParams == 0 || !ccode.get_parameter (nParams - 
1).ellipsis) {
                                                        Report.error (expr.source_reference, "`va_list' used 
in method with fixed args");
@@ -4620,22 +4646,23 @@ public abstract class Vala.CCodeBaseModule : CodeGenerator {
                                add_generic_type_arguments (in_arg_map, 
expr.type_reference.get_type_arguments (), expr);
                        } else if (cl != null && get_ccode_simple_generics (m)) {
                                int type_param_index = 0;
-                               foreach (var type_arg in expr.type_reference.get_type_arguments ()) {
+                               expr.type_reference.get_type_arguments ().foreach ((type_arg) => {
                                        if (requires_copy (type_arg)) {
                                                in_arg_map.set (get_param_pos (-1 + 0.1 * type_param_index + 
0.03), get_destroy0_func_expression (type_arg));
                                        } else {
                                                in_arg_map.set (get_param_pos (-1 + 0.1 * type_param_index + 
0.03), new CCodeConstant ("NULL"));
                                        }
                                        type_param_index++;
-                               }
+                                       return true;
+                               });
                        }
 
                        bool ellipsis = false;
 
                        int i = 1;
-                       int arg_pos;
+                       int arg_pos = 0;
                        Iterator<Parameter> params_it = params.iterator ();
-                       foreach (Expression arg in expr.get_argument_list ()) {
+                       expr.get_argument_list ().foreach ((arg) => {
                                CCodeExpression cexpr = get_cvalue (arg);
 
                                var carg_map = in_arg_map;
@@ -4693,7 +4720,8 @@ public abstract class Vala.CCodeBaseModule : CodeGenerator {
                                carg_map.set (arg_pos, cexpr);
 
                                i++;
-                       }
+                               return true;
+                       });
                        if (params_it.next ()) {
                                var param = params_it.get ();
                                
@@ -4808,9 +4836,10 @@ public abstract class Vala.CCodeBaseModule : CodeGenerator {
                        creation_call.add_argument (new CCodeIdentifier (get_ccode_upper_case_name 
(edomain)));
                        creation_call.add_argument (new CCodeIdentifier (get_ccode_name (ecode)));
 
-                       foreach (Expression arg in expr.get_argument_list ()) {
+                       expr.get_argument_list ().foreach ((arg) => {
                                creation_call.add_argument (get_cvalue (arg));
-                       }
+                               return true;
+                       });
 
                        creation_expr = creation_call;
                } else {
@@ -4829,7 +4858,7 @@ public abstract class Vala.CCodeBaseModule : CodeGenerator {
                                ccode.add_assignment (instance, creation_expr);
                        }
 
-                       foreach (MemberInitializer init in expr.get_object_initializer ()) {
+                       expr.get_object_initializer ().foreach ((init) => {
                                if (init.symbol_reference is Field) {
                                        var f = (Field) init.symbol_reference;
                                        var instance_target_type = get_data_type_for_symbol ((TypeSymbol) 
f.parent_symbol);
@@ -4846,7 +4875,8 @@ public abstract class Vala.CCodeBaseModule : CodeGenerator {
                                        set_cvalue (inst_ma, instance);
                                        store_property ((Property) init.symbol_reference, inst_ma, 
init.initializer.target_value);
                                }
-                       }
+                               return true;
+                       });
 
                        set_cvalue (expr, instance);
                } else if (creation_expr != null) {
@@ -6476,13 +6506,14 @@ public abstract class Vala.CCodeBaseModule : CodeGenerator {
                push_function (function);
 
                var this_value = load_this_parameter (st);
-               foreach (Field f in st.get_fields ()) {
+               st.get_fields ().foreach ((f) => {
                        if (f.binding == MemberBinding.INSTANCE) {
                                if (requires_destroy (f.variable_type)) {
                                        ccode.add_expression (destroy_field (f, this_value));
                                }
                        }
-               }
+                       return true;
+               });
 
                pop_function ();
                pop_context ();
@@ -6506,19 +6537,20 @@ public abstract class Vala.CCodeBaseModule : CodeGenerator {
                push_function (function);
 
                var dest_struct = new GLibValue (get_data_type_for_symbol (st), new CCodeIdentifier 
("(*dest)"), true);
-               foreach (Field f in st.get_fields ()) {
+               st.get_fields ().foreach ((f) => {
                        if (f.binding == MemberBinding.INSTANCE) {
                                var value = load_field (f, load_this_parameter ((TypeSymbol) st));
                                if (requires_copy (f.variable_type))  {
                                        value = copy_value (value, f);
                                        if (value == null) {
                                                // error case, continue to avoid critical
-                                               continue;
+                                               return true;
                                        }
                                }
                                store_field (f, dest_struct, value);
                        }
-               }
+                       return true;
+               });
 
                pop_function ();
                pop_context ();
@@ -6746,9 +6778,10 @@ internal class Vala.GLibValue : TargetValue {
                result.ctype = ctype;
 
                if (array_length_cvalues != null) {
-                       foreach (var cexpr in array_length_cvalues) {
+                       array_length_cvalues.foreach ((cexpr) => {
                                result.append_array_length_cvalue (cexpr);
-                       }
+                               return true;
+                       });
                }
                result.array_size_cvalue = array_size_cvalue;
                result.array_null_terminated = array_null_terminated;
diff --git a/codegen/valaccodecompiler.vala b/codegen/valaccodecompiler.vala
index 52161b4..e45f9fb 100644
--- a/codegen/valaccodecompiler.vala
+++ b/codegen/valaccodecompiler.vala
@@ -61,12 +61,13 @@ public class Vala.CCodeCompiler {
                }
                use_pkgconfig = true;
                pc += " gobject-2.0";
-               foreach (string pkg in context.get_packages ()) {
+               context.get_packages ().foreach ((pkg) => {
                        if (package_exists (pkg, pkg_config_command)) {
                                use_pkgconfig = true;
                                pc += " " + pkg;
                        }
-               }
+                       return true;
+               });
                string pkgflags = "";
                if (use_pkgconfig) {
                        try {
@@ -103,20 +104,22 @@ public class Vala.CCodeCompiler {
 
                /* we're only interested in non-pkg source files */
                var source_files = context.get_source_files ();
-               foreach (SourceFile file in source_files) {
+               source_files.foreach ((file) => {
                        if (file.file_type == SourceFileType.SOURCE) {
                                cmdline += " " + Shell.quote (file.get_csource_filename ());
                        }
-               }
+                       return true;
+               });
                var c_source_files = context.get_c_source_files ();
-               foreach (string file in c_source_files) {
+               c_source_files.foreach ((file) => {
                        cmdline += " " + Shell.quote (file);
-               }
+                       return true;
+               });
 
                // add libraries after source files to fix linking
                // with --as-needed and on Windows
                cmdline += " " + pkgflags.strip ();
-               foreach (string cc_option in cc_options) {
+               foreach (unowned string cc_option in cc_options) {
                        cmdline += " " + Shell.quote (cc_option);
                }
 
@@ -135,12 +138,13 @@ public class Vala.CCodeCompiler {
                }
 
                /* remove generated C source and header files */
-               foreach (SourceFile file in source_files) {
+               source_files.foreach ((file) => {
                        if (file.file_type == SourceFileType.SOURCE) {
                                if (!context.save_csources) {
                                        FileUtils.unlink (file.get_csource_filename ());
                                }
                        }
-               }
+                       return true;
+               });
        }
 }
diff --git a/codegen/valaccodecontrolflowmodule.vala b/codegen/valaccodecontrolflowmodule.vala
index 91268e7..ac596df 100644
--- a/codegen/valaccodecontrolflowmodule.vala
+++ b/codegen/valaccodecontrolflowmodule.vala
@@ -61,22 +61,22 @@ public abstract class Vala.CCodeControlFlowModule : CCodeMethodModule {
 
                int label_count = 0;
 
-               foreach (SwitchSection section in stmt.get_sections ()) {
-                       if (section.has_default_label ()) {
-                               continue;
-                       }
-
-                       foreach (SwitchLabel label in section.get_labels ()) {
-                               label.expression.emit (this);
-                               var cexpr = get_cvalue (label.expression);
-
-                               if (is_constant_ccode_expression (cexpr)) {
-                                       var cname = "_tmp%d_label%d".printf (label_temp_id, label_count++);
-
-                                       ccode.add_declaration (get_ccode_name (gquark_type), new 
CCodeVariableDeclarator (cname, czero), CCodeModifiers.STATIC);
-                               }
+               stmt.get_sections ().foreach ((section) => {
+                       if (!section.has_default_label ()) {
+                               section.get_labels ().foreach ((label) => {
+                                       label.expression.emit (this);
+                                       var cexpr = get_cvalue (label.expression);
+
+                                       if (is_constant_ccode_expression (cexpr)) {
+                                               var cname = "_tmp%d_label%d".printf (label_temp_id, 
label_count++);
+
+                                               ccode.add_declaration (get_ccode_name (gquark_type), new 
CCodeVariableDeclarator (cname, czero), CCodeModifiers.STATIC);
+                                       }
+                                       return true;
+                               });
                        }
-               }
+                       return true;
+               });
 
                ccode.add_expression (cinit);
 
@@ -95,14 +95,14 @@ public abstract class Vala.CCodeControlFlowModule : CCodeMethodModule {
 
                int n = 0;
 
-               foreach (SwitchSection section in stmt.get_sections ()) {
+               stmt.get_sections ().foreach ((section) => {
                        if (section.has_default_label ()) {
                                default_section = section;
-                               continue;
+                               return true;
                        }
 
                        CCodeBinaryExpression cor = null;
-                       foreach (SwitchLabel label in section.get_labels ()) {
+                       section.get_labels ().foreach ((label) => {
                                label.expression.emit (this);
                                var cexpr = get_cvalue (label.expression);
 
@@ -128,7 +128,8 @@ public abstract class Vala.CCodeControlFlowModule : CCodeMethodModule {
                                } else {
                                        cor = new CCodeBinaryExpression (CCodeBinaryOperator.OR, cor, ccmp);
                                }
-                       }
+                               return true;
+                       });
 
                        if (n > 0) {
                                ccode.else_if (cor);
@@ -144,7 +145,8 @@ public abstract class Vala.CCodeControlFlowModule : CCodeMethodModule {
                        ccode.close ();
 
                        n++;
-               }
+                       return true;
+               });
        
                if (default_section != null) {
                        if (n > 0) {
@@ -174,13 +176,14 @@ public abstract class Vala.CCodeControlFlowModule : CCodeMethodModule {
 
                bool has_default = false;
 
-               foreach (SwitchSection section in stmt.get_sections ()) {
+               stmt.get_sections ().foreach ((section) => {
                        if (section.has_default_label ()) {
                                ccode.add_default ();
                                has_default = true;
                        }
                        section.emit (this);
-               }
+                       return true;
+               });
 
                if (!has_default) {
                        // silence C compiler
@@ -335,11 +338,12 @@ public abstract class Vala.CCodeControlFlowModule : CCodeMethodModule {
                        ccode.close ();
                }
 
-               foreach (LocalVariable local in stmt.get_local_variables ()) {
+               stmt.get_local_variables ().foreach ((local) => {
                        if (requires_destroy (local.variable_type)) {
                                ccode.add_expression (destroy_local (local));
                        }
-               }
+                       return true;
+               });
 
                ccode.close ();
        }
diff --git a/codegen/valaccodedelegatemodule.vala b/codegen/valaccodedelegatemodule.vala
index f1120ae..db8d773 100644
--- a/codegen/valaccodedelegatemodule.vala
+++ b/codegen/valaccodedelegatemodule.vala
@@ -47,7 +47,7 @@ public class Vala.CCodeDelegateModule : CCodeArrayModule {
                }
 
                var cfundecl = new CCodeFunctionDeclarator (get_ccode_name (d));
-               foreach (Parameter param in d.get_parameters ()) {
+               d.get_parameters ().foreach ((param) => {
                        var cparam = generate_parameter (param, decl_space, new HashMap<int,CCodeParameter> 
(), null);
 
                        cfundecl.add_parameter (cparam);
@@ -79,7 +79,8 @@ public class Vala.CCodeDelegateModule : CCodeArrayModule {
                                        }
                                }
                        }
-               }
+                       return true;
+               });
                if (get_ccode_array_length (d) && d.return_type is ArrayType) {
                        // return array length if appropriate
                        var array_type = (ArrayType) d.return_type;
@@ -220,7 +221,7 @@ public class Vala.CCodeDelegateModule : CCodeArrayModule {
                }
 
                var d_params = d.get_parameters ();
-               foreach (Parameter param in d_params) {
+               d_params.foreach ((param) => {
                        if (dynamic_sig != null
                            && param.variable_type is ArrayType
                            && ((ArrayType) param.variable_type).element_type.data_type == 
string_type.data_type) {
@@ -230,7 +231,8 @@ public class Vala.CCodeDelegateModule : CCodeArrayModule {
                        }
 
                        generate_parameter (param, cfile, cparam_map, null);
-               }
+                       return true;
+               });
                if (get_ccode_array_length (d) && d.return_type is ArrayType) {
                        // return array length if appropriate
                        var array_type = (ArrayType) d.return_type;
@@ -308,13 +310,13 @@ public class Vala.CCodeDelegateModule : CCodeArrayModule {
 
                bool first = true;
 
-               foreach (Parameter param in m.get_parameters ()) {
+               m.get_parameters ().foreach ((param) => {
                        if (first && d.sender_type != null && m.get_parameters ().size == d.get_parameters 
().size + 1) {
                                // sender parameter
                                carg_map.set (get_param_pos (get_ccode_pos (param)), new CCodeIdentifier 
("_sender"));
 
                                first = false;
-                               continue;
+                               return true;
                        }
 
                        CCodeExpression arg;
@@ -355,7 +357,8 @@ public class Vala.CCodeDelegateModule : CCodeArrayModule {
                        }
 
                        i++;
-               }
+                       return true;
+               });
                if (get_ccode_array_length (m) && m.return_type is ArrayType) {
                        var array_type = (ArrayType) m.return_type;
                        for (int dim = 1; dim <= array_type.rank; dim++) {
diff --git a/codegen/valaccodemethodcallmodule.vala b/codegen/valaccodemethodcallmodule.vala
index 17a9cd5..0717b24 100644
--- a/codegen/valaccodemethodcallmodule.vala
+++ b/codegen/valaccodemethodcallmodule.vala
@@ -134,27 +134,29 @@ public class Vala.CCodeMethodCallModule : CCodeAssignmentModule {
                        if (!current_class.is_compact) {
                                if (current_class != m.parent_symbol) {
                                        // chain up to base class
-                                       foreach (DataType base_type in current_class.get_base_types ()) {
+                                       current_class.get_base_types ().foreach ((base_type) => {
                                                if (base_type.data_type is Class) {
-                                                       List<TypeParameter> type_parameters = null;
+                                                       List<TypeParameter>? type_parameters = null;
                                                        if (get_ccode_real_name (m) == "g_object_new") {
                                                                // gobject-style chainup
                                                                type_parameters = ((Class) 
base_type.data_type).get_type_parameters ();
                                                        }
                                                        add_generic_type_arguments (in_arg_map, 
base_type.get_type_arguments (), expr, true, type_parameters);
-                                                       break;
+                                                       return false;
                                                }
-                                       }
+                                               return true;
+                                       });
                                } else {
                                        // chain up to other constructor in same class
                                        int type_param_index = 0;
                                        var cl = (Class) m.parent_symbol;
-                                       foreach (TypeParameter type_param in cl.get_type_parameters ()) {
+                                       cl.get_type_parameters ().foreach ((type_param) => {
                                                in_arg_map.set (get_param_pos (0.1 * type_param_index + 
0.01), new CCodeIdentifier ("%s_type".printf (type_param.name.down ())));
                                                in_arg_map.set (get_param_pos (0.1 * type_param_index + 
0.02), new CCodeIdentifier ("%s_dup_func".printf (type_param.name.down ())));
                                                in_arg_map.set (get_param_pos (0.1 * type_param_index + 
0.03), new CCodeIdentifier ("%s_destroy_func".printf (type_param.name.down ())));
                                                type_param_index++;
-                                       }
+                                               return true;
+                                       });
                                }
                        } else if (current_class.base_class == gsource_type) {
                                // g_source_new
@@ -255,17 +257,19 @@ public class Vala.CCodeMethodCallModule : CCodeAssignmentModule {
                        if (m.get_type_parameters ().size > 0) {
                                // generic method
                                int type_param_index = 0;
-                               foreach (var type_arg in ma.get_type_arguments ()) {
+                               ma.get_type_arguments ().foreach ((type_arg) => {
                                        in_arg_map.set (get_param_pos (get_ccode_generic_type_pos (m) + 0.01 
* type_param_index), new CCodeIdentifier (get_ccode_name (type_arg)));
                                        type_param_index++;
-                               }
+                                       return true;
+                               });
                        } else {
                                // method in generic type
                                int type_param_index = 0;
-                               foreach (var type_arg in ma.inner.value_type.get_type_arguments ()) {
+                               ma.inner.value_type.get_type_arguments ().foreach ((type_arg) => {
                                        in_arg_map.set (get_param_pos (get_ccode_generic_type_pos (m) + 0.01 
* type_param_index), new CCodeIdentifier (get_ccode_name (type_arg)));
                                        type_param_index++;
-                               }
+                                       return true;
+                               });
                        }
                }
 
@@ -277,7 +281,7 @@ public class Vala.CCodeMethodCallModule : CCodeAssignmentModule {
                } else if (m is DynamicMethod) {
                        m.clear_parameters ();
                        int param_nr = 1;
-                       foreach (Expression arg in expr.get_argument_list ()) {
+                       expr.get_argument_list ().foreach ((arg) => {
                                var unary = arg as UnaryExpression;
                                if (unary != null && unary.operator == UnaryOperator.OUT) {
                                        // out argument
@@ -294,10 +298,12 @@ public class Vala.CCodeMethodCallModule : CCodeAssignmentModule {
                                        m.add_parameter (new Parameter ("param%d".printf (param_nr), 
arg.value_type));
                                }
                                param_nr++;
-                       }
-                       foreach (Parameter param in m.get_parameters ()) {
+                               return true;
+                       });
+                       m.get_parameters ().foreach ((param) => {
                                param.accept (this);
-                       }
+                               return true;
+                       });
                        generate_dynamic_method_wrapper ((DynamicMethod) m);
                } else if (m is CreationMethod && m.parent_symbol is Class) {
                        ccode.add_assignment (get_this_cexpression (), new CCodeCastExpression (ccall, 
CCodeBaseModule.get_ccode_name (current_class) + "*"));
@@ -313,14 +319,15 @@ public class Vala.CCodeMethodCallModule : CCodeAssignmentModule {
                        if (!current_class.is_compact && current_class.get_type_parameters ().size > 0) {
                                /* type, dup func, and destroy func fields for generic types */
                                var suffices = new string[] {"type", "dup_func", "destroy_func"};
-                               foreach (TypeParameter type_param in current_class.get_type_parameters ()) {
+                               current_class.get_type_parameters ().foreach ((type_param) => {
                                        var priv_access = new CCodeMemberAccess.pointer (new CCodeIdentifier 
("self"), "priv");
 
                                        foreach (string suffix in suffices) {
                                                var param_name = new CCodeIdentifier ("%s_%s".printf 
(type_param.name.down (), suffix));
                                                ccode.add_assignment (new CCodeMemberAccess.pointer 
(priv_access, param_name.name), param_name);
                                        }
-                               }
+                                       return true;
+                               });
                        }
                        // object chainup can't be used as expression
                        ccall_expr = null;
@@ -329,9 +336,9 @@ public class Vala.CCodeMethodCallModule : CCodeAssignmentModule {
                bool ellipsis = false;
                
                int i = 1;
-               int arg_pos;
+               int arg_pos = 0;
                Iterator<Parameter> params_it = params.iterator ();
-               foreach (Expression arg in expr.get_argument_list ()) {
+               expr.get_argument_list ().foreach ((arg) => {
                        CCodeExpression cexpr = get_cvalue (arg);
 
                        var carg_map = in_arg_map;
@@ -461,7 +468,8 @@ public class Vala.CCodeMethodCallModule : CCodeAssignmentModule {
                        }
 
                        i++;
-               }
+                       return true;
+               });
                if (params_it.next ()) {
                        var param = params_it.get ();
 
@@ -805,20 +813,20 @@ public class Vala.CCodeMethodCallModule : CCodeAssignmentModule {
                }
 
                params_it = params.iterator ();
-               foreach (Expression arg in expr.get_argument_list ()) {
+               expr.get_argument_list ().foreach ((arg) => {
                        Parameter param = null;
                        
                        if (params_it.next ()) {
                                param = params_it.get ();
                                if (param.params_array || param.ellipsis) {
                                        // ignore ellipsis arguments as we currently don't use temporary 
variables for them
-                                       break;
+                                       return false;
                                }
                        }
 
                        var unary = arg as UnaryExpression;
                        if (unary == null || unary.operator != UnaryOperator.OUT) {
-                               continue;
+                               return true;
                        }
 
                        if (requires_destroy (unary.inner.value_type)) {
@@ -837,7 +845,8 @@ public class Vala.CCodeMethodCallModule : CCodeAssignmentModule {
                                
                                ccode.add_assignment (get_array_length_cvalue (unary.inner.target_value, 1), 
len_call);
                        }
-               }
+                       return true;
+               });
 
                if (m is CreationMethod && m.parent_symbol is Class && current_class.base_class == 
gsource_type) {
                        var cinitcall = new CCodeFunctionCall (new CCodeIdentifier ("%s_instance_init".printf 
(get_ccode_lower_case_name (current_class, null))));
@@ -865,10 +874,11 @@ public class Vala.CCodeMethodCallModule : CCodeAssignmentModule {
                push_function (function);
 
                ccode.open_switch (new CCodeConstant ("value"));
-               foreach (var enum_value in en.get_values ()) {
+               en.get_values ().foreach ((enum_value) => {
                        ccode.add_case (new CCodeIdentifier (get_ccode_name (enum_value)));
                        ccode.add_return (new CCodeConstant ("\""+get_ccode_name (enum_value)+"\""));
-               }
+                       return true;
+               });
                ccode.close ();
                ccode.add_return (new CCodeConstant ("NULL"));
 
diff --git a/codegen/valaccodemethodmodule.vala b/codegen/valaccodemethodmodule.vala
index ff463b5..73a6c6c 100644
--- a/codegen/valaccodemethodmodule.vala
+++ b/codegen/valaccodemethodmodule.vala
@@ -111,9 +111,10 @@ public abstract class Vala.CCodeMethodModule : CCodeStructModule {
                }
 
                if (m.get_error_types ().size > 0 || (m.base_method != null && m.base_method.get_error_types 
().size > 0) || (m.base_interface_method != null && m.base_interface_method.get_error_types ().size > 0)) {
-                       foreach (DataType error_type in m.get_error_types ()) {
+                       m.get_error_types ().foreach ((error_type) => {
                                generate_type_declaration (error_type, decl_space);
-                       }
+                               return true;
+                       });
 
                        var cparam = new CCodeParameter ("error", "GError**");
                        cparam_map.set (get_param_pos (-1), cparam);
@@ -253,25 +254,30 @@ public abstract class Vala.CCodeMethodModule : CCodeStructModule {
                var cl = sym as Class;
                var iface = sym as Interface;
                if (ns != null) {
-                       foreach (var ns_ns in ns.get_namespaces ()) {
+                       ns.get_namespaces ().foreach ((ns_ns) => {
                                register_plugin_types (ns_ns, registered_types);
-                       }
-                       foreach (var ns_cl in ns.get_classes ()) {
+                               return true;
+                       });
+                       ns.get_classes ().foreach ((ns_cl) => {
                                register_plugin_types (ns_cl, registered_types);
-                       }
-                       foreach (var ns_iface in ns.get_interfaces ()) {
+                               return true;
+                       });
+                       ns.get_interfaces ().foreach ((ns_iface) => {
                                register_plugin_types (ns_iface, registered_types);
-                       }
+                               return true;
+                       });
                } else if (cl != null) {
                        register_plugin_type (cl, registered_types);
-                       foreach (var cl_cl in cl.get_classes ()) {
+                       cl.get_classes ().foreach ((cl_cl) => {
                                register_plugin_types (cl_cl, registered_types);
-                       }
+                               return true;
+                       });
                } else if (iface != null) {
                        register_plugin_type (iface, registered_types);
-                       foreach (var iface_cl in iface.get_classes ()) {
+                       iface.get_classes ().foreach ((iface_cl) => {
                                register_plugin_types (iface_cl, registered_types);
-                       }
+                               return true;
+                       });
                }
        }
 
@@ -292,9 +298,10 @@ public abstract class Vala.CCodeMethodModule : CCodeStructModule {
                        }
 
                        // register base types first
-                       foreach (var base_type in cl.get_base_types ()) {
+                       cl.get_base_types ().foreach ((base_type) => {
                                register_plugin_type ((ObjectTypeSymbol) base_type.data_type, 
registered_types);
-                       }
+                               return true;
+                       });
                }
 
                var register_call = new CCodeFunctionCall (new CCodeIdentifier ("%s_register_type".printf 
(get_ccode_lower_case_name (type_symbol, null))));
@@ -357,9 +364,10 @@ public abstract class Vala.CCodeMethodModule : CCodeStructModule {
                        creturn_type = new VoidType ();
                }
 
-               foreach (Parameter param in m.get_parameters ()) {
+               m.get_parameters ().foreach ((param) => {
                        param.accept (this);
-               }
+                       return true;
+               });
 
                // do not declare overriding methods and interface implementations
                if ((m.is_abstract || m.is_virtual
@@ -531,7 +539,7 @@ public abstract class Vala.CCodeMethodModule : CCodeStructModule {
                                        }
 
                                        // allow capturing generic type parameters
-                                       foreach (var type_param in m.get_type_parameters ()) {
+                                       m.get_type_parameters ().foreach ((type_param) => {
                                                string func_name;
 
                                                func_name = "%s_type".printf (type_param.name.down ());
@@ -545,7 +553,8 @@ public abstract class Vala.CCodeMethodModule : CCodeStructModule {
                                                func_name = "%s_destroy_func".printf (type_param.name.down 
());
                                                ccode.add_declaration ("GDestroyNotify", new 
CCodeVariableDeclarator (func_name));
                                                ccode.add_assignment (new CCodeIdentifier (func_name), new 
CCodeMemberAccess.pointer (get_variable_cexpression ("_data%d_".printf (block_id)), func_name));
-                                       }
+                                               return true;
+                                       });
                                } else if (m.parent_symbol is Class && !m.coroutine) {
                                        var cl = (Class) m.parent_symbol;
                                        if (m.overrides || (m.base_interface_method != null && !m.is_abstract 
&& !m.is_virtual)) {
@@ -570,9 +579,9 @@ public abstract class Vala.CCodeMethodModule : CCodeStructModule {
                                        }
                                }
 
-                               foreach (Parameter param in m.get_parameters ()) {
+                               m.get_parameters ().foreach ((param) => {
                                        if (param.ellipsis) {
-                                               break;
+                                               return false;
                                        }
 
                                        if (param.direction != ParameterDirection.OUT) {
@@ -614,7 +623,8 @@ public abstract class Vala.CCodeMethodModule : CCodeStructModule {
                                                        }
                                                }
                                        }
-                               }
+                                       return true;
+                               });
 
                                if (!(m.return_type is VoidType) && 
!m.return_type.is_real_non_null_struct_type () && !m.coroutine) {
                                        var vardecl = new CCodeVariableDeclarator ("result", 
default_value_for_type (m.return_type, true));
@@ -637,7 +647,7 @@ public abstract class Vala.CCodeMethodModule : CCodeStructModule {
                                                        ccode.add_assignment (get_this_cexpression (), new 
CCodeCastExpression (ccall, get_ccode_name (cl) + "*"));
 
                                                        /* type, dup func, and destroy func fields for 
generic types */
-                                                       foreach (TypeParameter type_param in 
current_class.get_type_parameters ()) {
+                                                       current_class.get_type_parameters ().foreach 
((type_param) => {
                                                                CCodeIdentifier param_name;
                                                                CCodeAssignment assign;
 
@@ -654,7 +664,8 @@ public abstract class Vala.CCodeMethodModule : CCodeStructModule {
                                                                param_name = new CCodeIdentifier 
("%s_destroy_func".printf (type_param.name.down ()));
                                                                assign = new CCodeAssignment (new 
CCodeMemberAccess.pointer (priv_access, param_name.name), param_name);
                                                                ccode.add_expression (assign);
-                                                       }
+                                                               return true;
+                                                       });
                                                }
                                        } else if (current_type_symbol is Class) {
                                                var cl = (Class) m.parent_symbol;
@@ -693,9 +704,10 @@ public abstract class Vala.CCodeMethodModule : CCodeStructModule {
                                        register_plugin_types (context.root, new HashSet<Symbol> ());
                                }
 
-                               foreach (Expression precondition in m.get_preconditions ()) {
+                               m.get_preconditions ().foreach ((precondition) => {
                                        create_precondition_statement (m, creturn_type, precondition);
-                               }
+                                       return true;
+                               });
                        }
                }
 
@@ -981,7 +993,7 @@ public abstract class Vala.CCodeMethodModule : CCodeStructModule {
                        // memory management for generic types
                        int type_param_index = 0;
                        var cl = (Class) m.parent_symbol;
-                       foreach (TypeParameter type_param in cl.get_type_parameters ()) {
+                       cl.get_type_parameters ().foreach ((type_param) => {
                                cparam_map.set (get_param_pos (0.1 * type_param_index + 0.01), new 
CCodeParameter ("%s_type".printf (type_param.name.down ()), "GType"));
                                cparam_map.set (get_param_pos (0.1 * type_param_index + 0.02), new 
CCodeParameter ("%s_dup_func".printf (type_param.name.down ()), "GBoxedCopyFunc"));
                                cparam_map.set (get_param_pos (0.1 * type_param_index + 0.03), new 
CCodeParameter ("%s_destroy_func".printf (type_param.name.down ()), "GDestroyNotify"));
@@ -991,10 +1003,11 @@ public abstract class Vala.CCodeMethodModule : CCodeStructModule {
                                        carg_map.set (get_param_pos (0.1 * type_param_index + 0.03), new 
CCodeIdentifier ("%s_destroy_func".printf (type_param.name.down ())));
                                }
                                type_param_index++;
-                       }
+                               return true;
+                       });
                } else if (!m.closure && (direction & 1) == 1) {
                        int type_param_index = 0;
-                       foreach (var type_param in m.get_type_parameters ()) {
+                       m.get_type_parameters ().foreach ((type_param) => {
                                cparam_map.set (get_param_pos (0.1 * type_param_index + 0.01), new 
CCodeParameter ("%s_type".printf (type_param.name.down ()), "GType"));
                                cparam_map.set (get_param_pos (0.1 * type_param_index + 0.02), new 
CCodeParameter ("%s_dup_func".printf (type_param.name.down ()), "GBoxedCopyFunc"));
                                cparam_map.set (get_param_pos (0.1 * type_param_index + 0.03), new 
CCodeParameter ("%s_destroy_func".printf (type_param.name.down ()), "GDestroyNotify"));
@@ -1004,24 +1017,26 @@ public abstract class Vala.CCodeMethodModule : CCodeStructModule {
                                        carg_map.set (get_param_pos (0.1 * type_param_index + 0.03), new 
CCodeIdentifier ("%s_destroy_func".printf (type_param.name.down ())));
                                }
                                type_param_index++;
-                       }
+                               return true;
+                       });
                }
 
-               foreach (Parameter param in m.get_parameters ()) {
+               m.get_parameters ().foreach ((param) => {
                        if (param.direction != ParameterDirection.OUT) {
                                if ((direction & 1) == 0) {
                                        // no in parameters
-                                       continue;
+                                       return true;
                                }
                        } else {
                                if ((direction & 2) == 0) {
                                        // no out parameters
-                                       continue;
+                                       return true;
                                }
                        }
 
                        generate_parameter (param, decl_space, cparam_map, carg_map);
-               }
+                       return true;
+               });
 
                if ((direction & 2) != 0) {
                        generate_method_result_declaration (m, decl_space, func, cparam_map, carg_map);
@@ -1102,9 +1117,10 @@ public abstract class Vala.CCodeMethodModule : CCodeStructModule {
                // add a typecheck statement for "self"
                create_method_type_check_statement (m, return_type, (TypeSymbol) m.parent_symbol, true, 
"self");
 
-               foreach (Expression precondition in m.get_preconditions ()) {
+               m.get_preconditions ().foreach ((precondition) => {
                        create_precondition_statement (m, return_type, precondition);
-               }
+                       return true;
+               });
 
                if (return_type is VoidType || return_type.is_real_non_null_struct_type ()) {
                        ccode.add_expression (vcall);
@@ -1118,9 +1134,10 @@ public abstract class Vala.CCodeMethodModule : CCodeStructModule {
                }
 
                if (m.get_postconditions ().size > 0) {
-                       foreach (Expression postcondition in m.get_postconditions ()) {
+                       m.get_postconditions ().foreach ((postcondition) => {
                                create_postcondition_statement (postcondition);
-                       }
+                               return true;
+                       });
 
                        if (!(return_type is VoidType)) {
                                ccode.add_return (new CCodeIdentifier ("result"));
@@ -1243,14 +1260,15 @@ public abstract class Vala.CCodeMethodModule : CCodeStructModule {
                if (m.is_variadic ()) {
                        int last_pos = -1;
                        int second_last_pos = -1;
-                       foreach (int pos in cparam_map.keys) {
+                       cparam_map.keys.foreach ((pos) => {
                                if (pos > last_pos) {
                                        second_last_pos = last_pos;
                                        last_pos = pos;
                                } else if (pos > second_last_pos) {
                                        second_last_pos = pos;
                                }
-                       }
+                               return true;
+                       });
 
                        var va_start = new CCodeFunctionCall (new CCodeIdentifier ("va_start"));
                        va_start.add_argument (new CCodeIdentifier ("_vala_va_list_obj"));
diff --git a/codegen/valaccodestructmodule.vala b/codegen/valaccodestructmodule.vala
index 1eb6a57..cc409ca 100644
--- a/codegen/valaccodestructmodule.vala
+++ b/codegen/valaccodestructmodule.vala
@@ -66,7 +66,7 @@ public abstract class Vala.CCodeStructModule : CCodeBaseModule {
                var instance_struct = new CCodeStruct ("_%s".printf (get_ccode_name (st)));
                instance_struct.modifiers |= (st.version.deprecated ? CCodeModifiers.DEPRECATED : 0);
 
-               foreach (Field f in st.get_fields ()) {
+               st.get_fields ().foreach ((f) => {
                        if (f.binding == MemberBinding.INSTANCE)  {
                                generate_type_declaration (f.variable_type, decl_space);
                                CCodeModifiers modifiers = (f.is_volatile ? CCodeModifiers.VOLATILE : 0) | 
(f.version.deprecated ? CCodeModifiers.DEPRECATED : 0);
@@ -103,7 +103,8 @@ public abstract class Vala.CCodeStructModule : CCodeBaseModule {
                                        }
                                }
                        }
-               }
+                       return true;
+               });
 
                if (st.base_struct == null) {
                        decl_space.add_type_declaration (new CCodeTypeDefinition ("struct _%s".printf 
(get_ccode_name (st)), new CCodeVariableDeclarator (get_ccode_name (st))));
@@ -276,19 +277,20 @@ public abstract class Vala.CCodeStructModule : CCodeBaseModule {
                push_function (function);
 
                var dest_struct = new GLibValue (get_data_type_for_symbol (st), new CCodeIdentifier 
("(*dest)"), true);
-               foreach (var f in st.get_fields ()) {
+               st.get_fields ().foreach ((f) => {
                        if (f.binding == MemberBinding.INSTANCE) {
                                var value = load_field (f, load_this_parameter ((TypeSymbol) st));
                                if (requires_copy (f.variable_type))  {
                                        value = copy_value (value, f);
                                        if (value == null) {
                                                // error case, continue to avoid critical
-                                               continue;
+                                               return true;
                                        }
                                }
                                store_field (f, dest_struct, value);
                        }
-               }
+                       return true;
+               });
 
                pop_function ();
 
diff --git a/codegen/valaclassregisterfunction.vala b/codegen/valaclassregisterfunction.vala
index 01aa54c..54d7350 100644
--- a/codegen/valaclassregisterfunction.vala
+++ b/codegen/valaclassregisterfunction.vala
@@ -153,9 +153,9 @@ public class Vala.ClassRegisterFunction : TypeRegisterFunction {
        public override CCodeFragment get_type_interface_init_declaration () {
                var frag = new CCodeFragment ();
                
-               foreach (DataType base_type in class_reference.get_base_types ()) {
+               class_reference.get_base_types ().foreach ((base_type) => {
                        if (!(base_type.data_type is Interface)) {
-                               continue;
+                               return true;
                        }
                        
                        var iface = (Interface) base_type.data_type;
@@ -166,15 +166,16 @@ public class Vala.ClassRegisterFunction : TypeRegisterFunction {
                        ctypedecl.modifiers = CCodeModifiers.STATIC;
                        ctypedecl.add_declarator (new CCodeVariableDeclarator (iface_info_name, new 
CCodeConstant ("{ (GInterfaceInitFunc) %s_%s_interface_init, (GInterfaceFinalizeFunc) NULL, NULL}".printf 
(CCodeBaseModule.get_ccode_lower_case_name (class_reference), CCodeBaseModule.get_ccode_lower_case_name 
(iface)))));
                        frag.append (ctypedecl);
-               }
+                       return true;
+               });
                
                return frag;
        }
 
        public override void get_type_interface_init_statements (CCodeBlock block, bool plugin) {
-               foreach (DataType base_type in class_reference.get_base_types ()) {
+               class_reference.get_base_types ().foreach ((base_type) => {
                        if (!(base_type.data_type is Interface)) {
-                               continue;
+                               return true;
                        }
                        
                        var iface = (Interface) base_type.data_type;
@@ -194,7 +195,8 @@ public class Vala.ClassRegisterFunction : TypeRegisterFunction {
                                reg_call.add_argument (new CCodeIdentifier ("&%s".printf (iface_info_name)));
                                block.add_statement (new CCodeExpressionStatement (reg_call));
                        }
-               }
+                       return true;
+               });
                
                ((CCodeBaseModule) context.codegen).register_dbus_info (block, class_reference);
        }
diff --git a/codegen/valagasyncmodule.vala b/codegen/valagasyncmodule.vala
index ad17981..30f51ad 100644
--- a/codegen/valagasyncmodule.vala
+++ b/codegen/valagasyncmodule.vala
@@ -50,7 +50,7 @@ public class Vala.GAsyncModule : GtkModule {
                        }
                }
 
-               foreach (Parameter param in m.get_parameters ()) {
+               m.get_parameters ().foreach ((param) => {
                        bool is_unowned_delegate = param.variable_type is DelegateType && 
!param.variable_type.value_owned;
 
                        var param_type = param.variable_type.copy ();
@@ -73,13 +73,15 @@ public class Vala.GAsyncModule : GtkModule {
                                        }
                                }
                        }
-               }
+                       return true;
+               });
 
-               foreach (var type_param in m.get_type_parameters ()) {
+               m.get_type_parameters ().foreach ((type_param) => {
                        data.add_field ("GType", "%s_type".printf (type_param.name.down ()));
                        data.add_field ("GBoxedCopyFunc", "%s_dup_func".printf (type_param.name.down ()));
                        data.add_field ("GDestroyNotify", "%s_destroy_func".printf (type_param.name.down ()));
-               }
+                       return true;
+               });
 
                if (!(m.return_type is VoidType)) {
                        data.add_field (get_ccode_name (m.return_type), "result");
@@ -114,7 +116,7 @@ public class Vala.GAsyncModule : GtkModule {
 
                ccode.add_declaration (dataname + "*", new CCodeVariableDeclarator ("_data_", new 
CCodeIdentifier ("_data")));
 
-               foreach (Parameter param in m.get_parameters ()) {
+               m.get_parameters ().foreach ((param) => {
                        if (!param.captured && param.direction != ParameterDirection.OUT) {
                                var param_type = param.variable_type.copy ();
                                if (!param_type.value_owned) {
@@ -125,7 +127,8 @@ public class Vala.GAsyncModule : GtkModule {
                                        ccode.add_expression (destroy_parameter (param));
                                }
                        }
-               }
+                       return true;
+               });
 
                if (requires_destroy (m.return_type)) {
                        if (get_ccode_array_length (m) || !(m.return_type is ArrayType)) {
@@ -289,7 +292,7 @@ public class Vala.GAsyncModule : GtkModule {
                }
 
                emit_context.push_symbol (m);
-               foreach (Parameter param in m.get_parameters ()) {
+               m.get_parameters ().foreach ((param) => {
                        if (param.direction != ParameterDirection.OUT) {
                                // create copy if necessary as variables in async methods may need to be kept 
alive
                                var old_captured = param.captured;
@@ -311,17 +314,19 @@ public class Vala.GAsyncModule : GtkModule {
 
                                param.captured = old_captured;
                        }
-               }
+                       return true;
+               });
                emit_context.pop_symbol ();
 
-               foreach (var type_param in m.get_type_parameters ()) {
+               m.get_type_parameters ().foreach ((type_param) => {
                        var type = "%s_type".printf (type_param.name.down ());
                        var dup_func = "%s_dup_func".printf (type_param.name.down ());
                        var destroy_func = "%s_destroy_func".printf (type_param.name.down ());
                        ccode.add_assignment (new CCodeMemberAccess.pointer (data_var, type), new 
CCodeIdentifier (type));
                        ccode.add_assignment (new CCodeMemberAccess.pointer (data_var, dup_func), new 
CCodeIdentifier (dup_func));
                        ccode.add_assignment (new CCodeMemberAccess.pointer (data_var, destroy_func), new 
CCodeIdentifier (destroy_func));
-               }
+                       return true;
+               });
 
                var ccall = new CCodeFunctionCall (new CCodeIdentifier (get_ccode_real_name (m) + "_co"));
                ccall.add_argument (data_var);
@@ -614,14 +619,15 @@ public class Vala.GAsyncModule : GtkModule {
                }
 
                emit_context.push_symbol (m);
-               foreach (Parameter param in m.get_parameters ()) {
+               m.get_parameters ().foreach ((param) => {
                        if (param.direction != ParameterDirection.IN) {
                                return_out_parameter (param);
                                if (!(param.variable_type is ValueType) || param.variable_type.nullable) {
                                        ccode.add_assignment (new CCodeMemberAccess.pointer (data_var, 
get_variable_cname (param.name)), new CCodeConstant ("NULL"));
                                }
                        }
-               }
+                       return true;
+               });
                emit_context.pop_symbol ();
 
                if (m is CreationMethod) {
@@ -765,9 +771,10 @@ public class Vala.GAsyncModule : GtkModule {
 
                /* free temporary objects */
 
-               foreach (var value in temp_ref_values) {
+               temp_ref_values.foreach ((value) => {
                        ccode.add_expression (destroy_value (value));
-               }
+                       return true;
+               });
 
                temp_ref_values.clear ();
        }
diff --git a/codegen/valagdbusclientmodule.vala b/codegen/valagdbusclientmodule.vala
index 78b5aec..f69e177 100644
--- a/codegen/valagdbusclientmodule.vala
+++ b/codegen/valagdbusclientmodule.vala
@@ -68,11 +68,12 @@ public class Vala.GDBusClientModule : GDBusModule {
 
        void generate_proxy_interface_init (Interface main_iface, Interface iface) {
                // also generate proxy for prerequisites
-               foreach (var prereq in iface.get_prerequisites ()) {
+               iface.get_prerequisites ().foreach ((prereq) => {
                        if (prereq.data_type is Interface) {
                                generate_proxy_interface_init (main_iface, (Interface) prereq.data_type);
                        }
-               }
+                       return true;
+               });
 
                string lower_cname = get_ccode_lower_case_prefix (main_iface) + "proxy";
 
@@ -81,9 +82,9 @@ public class Vala.GDBusClientModule : GDBusModule {
 
                push_function (proxy_iface_init);
 
-               foreach (Method m in iface.get_methods ()) {
+               iface.get_methods ().foreach ((m) => {
                        if (!m.is_abstract) {
-                               continue;
+                               return true;
                        }
 
                        var vfunc_entry = new CCodeMemberAccess.pointer (new CCodeIdentifier ("iface"), 
get_ccode_vfunc_name (m));
@@ -94,11 +95,12 @@ public class Vala.GDBusClientModule : GDBusModule {
                                vfunc_entry = new CCodeMemberAccess.pointer (new CCodeIdentifier ("iface"), 
get_ccode_finish_vfunc_name (m));
                                ccode.add_assignment (vfunc_entry, new CCodeIdentifier 
(generate_finish_dbus_proxy_method (main_iface, iface, m)));
                        }
-               }
+                       return true;
+               });
 
-               foreach (Property prop in iface.get_properties ()) {
+               iface.get_properties ().foreach ((prop) => {
                        if (!prop.is_abstract) {
-                               continue;
+                               return true;
                        }
 
                        if (prop.get_accessor != null) {
@@ -109,7 +111,8 @@ public class Vala.GDBusClientModule : GDBusModule {
                                var vfunc_entry = new CCodeMemberAccess.pointer (new CCodeIdentifier 
("iface"), "set_" + prop.name);
                                ccode.add_assignment (vfunc_entry, new CCodeIdentifier 
(generate_dbus_proxy_property_set (main_iface, iface, prop)));
                        }
-               }
+                       return true;
+               });
 
                proxy_iface_init.modifiers = CCodeModifiers.STATIC;
                pop_function ();
@@ -121,11 +124,12 @@ public class Vala.GDBusClientModule : GDBusModule {
                string result = "";
 
                // also implement prerequisites
-               foreach (var prereq in iface.get_prerequisites ()) {
+               iface.get_prerequisites ().foreach ((prereq) => {
                        if (prereq.data_type is Interface) {
                                result += implement_interface (define_type, main_iface, (Interface) 
prereq.data_type);
                        }
-               }
+                       return true;
+               });
 
                string interface_macro;
 
@@ -456,7 +460,7 @@ public class Vala.GDBusClientModule : GDBusModule {
                ccall.add_argument (new CCodeIdentifier ("self"));
                ccall.add_argument (get_signal_canonical_constant (sig));
 
-               foreach (Parameter param in sig.get_parameters ()) {
+               sig.get_parameters ().foreach ((param) => {
                        var param_name = get_variable_cname (param.name);
                        var owned_type = param.variable_type.copy ();
                        owned_type.value_owned = true;
@@ -482,11 +486,12 @@ public class Vala.GDBusClientModule : GDBusModule {
                        }
 
                        read_expression (param.variable_type, new CCodeIdentifier ("_arguments_iter"), new 
CCodeIdentifier (param_name), param);
-               }
+                       return true;
+               });
 
                ccode.add_expression (ccall);
 
-               foreach (Parameter param in sig.get_parameters ()) {
+               sig.get_parameters ().foreach ((param) => {
                        var owned_type = param.variable_type.copy ();
                        owned_type.value_owned = true;
 
@@ -495,7 +500,8 @@ public class Vala.GDBusClientModule : GDBusModule {
                                var local = new LocalVariable (owned_type, param.name);
                                ccode.add_expression (destroy_local (local));
                        }
-               }
+                       return true;
+               });
 
                pop_function ();
 
@@ -520,9 +526,9 @@ public class Vala.GDBusClientModule : GDBusModule {
 
                bool firstif = true;
 
-               foreach (Signal sig in sym.get_signals ()) {
+               sym.get_signals ().foreach ((sig) => {
                        if (sig.access != SymbolAccessibility.PUBLIC) {
-                               continue;
+                               return true;
                        }
 
                        cfile.add_include ("string.h");
@@ -544,7 +550,8 @@ public class Vala.GDBusClientModule : GDBusModule {
                        ccall.add_argument (new CCodeIdentifier ("parameters"));
 
                        ccode.add_expression (ccall);
-               }
+                       return true;
+               });
                if (!firstif) {
                        ccode.close ();
                }
@@ -584,12 +591,13 @@ public class Vala.GDBusClientModule : GDBusModule {
                        }
 
                        // register errors
-                       foreach (var error_type in m.get_error_types ()) {
+                       m.get_error_types ().foreach ((error_type) => {
                                var errtype = (ErrorType) error_type;
                                if (errtype.error_domain != null) {
                                        ccode.add_expression (new CCodeIdentifier (get_ccode_upper_case_name 
(errtype.error_domain)));
                                }
-                       }
+                               return true;
+                       });
 
                        // build D-Bus message
 
@@ -621,7 +629,7 @@ public class Vala.GDBusClientModule : GDBusModule {
 
                        CCodeExpression cancellable = new CCodeConstant ("NULL");
 
-                       foreach (Parameter param in m.get_parameters ()) {
+                       m.get_parameters ().foreach ((param) => {
                                if (param.direction == ParameterDirection.IN) {
                                        CCodeExpression expr = new CCodeIdentifier (get_variable_cname 
(param.name));
                                        if (param.variable_type.is_real_struct_type ()) {
@@ -630,17 +638,18 @@ public class Vala.GDBusClientModule : GDBusModule {
 
                                        if (param.variable_type is ObjectType && 
param.variable_type.data_type.get_full_name () == "GLib.Cancellable") {
                                                cancellable = expr;
-                                               continue;
+                                               return true;
                                        }
 
                                        if (param.variable_type is ObjectType && 
param.variable_type.data_type.get_full_name () == "GLib.BusName") {
                                                // ignore BusName sender parameters
-                                               continue;
+                                               return true;
                                        }
 
                                        send_dbus_value (param.variable_type, new CCodeIdentifier 
("_arguments_builder"), expr, param);
                                }
-                       }
+                               return true;
+                       });
 
                        var builder_end = new CCodeFunctionCall (new CCodeIdentifier 
("g_variant_builder_end"));
                        builder_end.add_argument (new CCodeUnaryExpression (CCodeUnaryOperator.ADDRESS_OF, 
new CCodeIdentifier ("_arguments_builder")));
@@ -774,11 +783,12 @@ public class Vala.GDBusClientModule : GDBusModule {
                                ccode.add_declaration ("gint", new CCodeVariableDeclarator.zero ("_fd_index", 
new CCodeConstant ("0")));
                        }
 
-                       foreach (Parameter param in m.get_parameters ()) {
+                       m.get_parameters ().foreach ((param) => {
                                if (param.direction == ParameterDirection.OUT) {
                                        has_result = true;
                                }
-                       }
+                               return true;
+                       });
 
                        if (has_result) {
                                ccode.add_declaration ("GVariant", new CCodeVariableDeclarator ("*_reply"));
@@ -793,7 +803,7 @@ public class Vala.GDBusClientModule : GDBusModule {
                                iter_init.add_argument (new CCodeIdentifier ("_reply"));
                                ccode.add_expression (iter_init);
 
-                               foreach (Parameter param in m.get_parameters ()) {
+                               m.get_parameters ().foreach ((param) => {
                                        if (param.direction == ParameterDirection.OUT) {
                                                ccode.add_declaration (get_ccode_name (param.variable_type), 
new CCodeVariableDeclarator ("_vala_%s".printf (param.name)));
 
@@ -827,7 +837,8 @@ public class Vala.GDBusClientModule : GDBusModule {
                                                        ccode.close ();
                                                }
                                        }
-                               }
+                                       return true;
+                               });
 
                                if (!(m.return_type is VoidType)) {
                                        if (m.return_type.is_real_non_null_struct_type ()) {
diff --git a/codegen/valagdbusmodule.vala b/codegen/valagdbusmodule.vala
index 8f10daa..ff0865a 100644
--- a/codegen/valagdbusmodule.vala
+++ b/codegen/valagdbusmodule.vala
@@ -81,7 +81,7 @@ public class Vala.GDBusModule : GVariantModule {
                }
 
                var error_entries = new CCodeInitializerList ();
-               foreach (ErrorCode ecode in edomain.get_codes ()) {
+               edomain.get_codes ().foreach ((ecode) => {
                        var ecode_dbus_name = get_dbus_name (ecode);
                        if (ecode_dbus_name == null) {
                                ecode_dbus_name = Symbol.lower_case_to_camel_case (ecode.name.down ());
@@ -91,7 +91,8 @@ public class Vala.GDBusModule : GVariantModule {
                        error_entry.append (new CCodeIdentifier (get_ccode_name (ecode)));
                        error_entry.append (new CCodeConstant ("\"%s.%s\"".printf (edomain_dbus_name, 
ecode_dbus_name)));
                        error_entries.append (error_entry);
-               }
+                       return true;
+               });
 
                var cdecl = new CCodeDeclaration ("const GDBusErrorEntry");
                cdecl.add_declarator (new CCodeVariableDeclarator (get_ccode_lower_case_name (edomain) + 
"_entries[]", error_entries));
@@ -242,24 +243,24 @@ public class Vala.GDBusModule : GVariantModule {
        CCodeExpression get_method_info (ObjectTypeSymbol sym) {
                var infos = new CCodeInitializerList ();
 
-               foreach (Method m in sym.get_methods ()) {
+               sym.get_methods ().foreach ((m) => {
                        if (m is CreationMethod || m.binding != MemberBinding.INSTANCE
                            || m.overrides || m.access != SymbolAccessibility.PUBLIC) {
-                               continue;
+                               return true;
                        }
                        if (!is_dbus_visible (m)) {
-                               continue;
+                               return true;
                        }
 
                        var in_args_info = new CCodeInitializerList ();
                        var out_args_info = new CCodeInitializerList ();
 
-                       foreach (Parameter param in m.get_parameters ()) {
+                       m.get_parameters ().foreach ((param) => {
                                if (param.variable_type is ObjectType && 
param.variable_type.data_type.get_full_name () == "GLib.Cancellable") {
-                                       continue;
+                                       return true;
                                }
                                if (param.variable_type is ObjectType && 
param.variable_type.data_type.get_full_name () == "GLib.BusName") {
-                                       continue;
+                                       return true;
                                }
 
                                var info = new CCodeInitializerList ();
@@ -277,7 +278,8 @@ public class Vala.GDBusModule : GVariantModule {
                                } else {
                                        out_args_info.append (new CCodeUnaryExpression 
(CCodeUnaryOperator.ADDRESS_OF, new CCodeIdentifier ("_" + get_ccode_lower_case_prefix (sym) + 
"dbus_arg_info_" + m.name + "_" + param.name)));
                                }
-                       }
+                               return true;
+                       });
 
                        if (!(m.return_type is VoidType)) {
                                var info = new CCodeInitializerList ();
@@ -318,7 +320,8 @@ public class Vala.GDBusModule : GVariantModule {
                        cfile.add_constant_declaration (cdecl);
 
                        infos.append (new CCodeUnaryExpression (CCodeUnaryOperator.ADDRESS_OF, new 
CCodeIdentifier ("_" + get_ccode_lower_case_prefix (sym) + "dbus_method_info_" + m.name)));
-               }
+                       return true;
+               });
 
                infos.append (new CCodeConstant ("NULL"));
 
@@ -333,17 +336,17 @@ public class Vala.GDBusModule : GVariantModule {
        CCodeExpression get_signal_info (ObjectTypeSymbol sym) {
                var infos = new CCodeInitializerList ();
 
-               foreach (Signal sig in sym.get_signals ()) {
+               sym.get_signals ().foreach ((sig) => {
                        if (sig.access != SymbolAccessibility.PUBLIC) {
-                               continue;
+                               return true;
                        }
                        if (!is_dbus_visible (sig)) {
-                               continue;
+                               return true;
                        }
 
                        var args_info = new CCodeInitializerList ();
 
-                       foreach (Parameter param in sig.get_parameters ()) {
+                       sig.get_parameters ().foreach ((param) => {
                                var info = new CCodeInitializerList ();
                                info.append (new CCodeConstant ("-1"));
                                info.append (new CCodeConstant ("\"%s\"".printf (param.name)));
@@ -355,7 +358,8 @@ public class Vala.GDBusModule : GVariantModule {
                                cfile.add_constant_declaration (cdecl);
 
                                args_info.append (new CCodeUnaryExpression (CCodeUnaryOperator.ADDRESS_OF, 
new CCodeIdentifier ("_" + get_ccode_lower_case_prefix (sym) + "dbus_arg_info_" + get_ccode_name (sig) + "_" 
+ param.name)));
-                       }
+                               return true;
+                       });
 
                        args_info.append (new CCodeConstant ("NULL"));
 
@@ -375,7 +379,8 @@ public class Vala.GDBusModule : GVariantModule {
                        cfile.add_constant_declaration (cdecl);
 
                        infos.append (new CCodeUnaryExpression (CCodeUnaryOperator.ADDRESS_OF, new 
CCodeIdentifier ("_" + get_ccode_lower_case_prefix (sym) + "dbus_signal_info_" + get_ccode_name (sig))));
-               }
+                       return true;
+               });
 
                infos.append (new CCodeConstant ("NULL"));
 
@@ -390,13 +395,13 @@ public class Vala.GDBusModule : GVariantModule {
        CCodeExpression get_property_info (ObjectTypeSymbol sym) {
                var infos = new CCodeInitializerList ();
 
-               foreach (Property prop in sym.get_properties ()) {
+               sym.get_properties ().foreach ((prop) => {
                        if (prop.binding != MemberBinding.INSTANCE
                            || prop.overrides || prop.access != SymbolAccessibility.PUBLIC) {
-                               continue;
+                               return true;
                        }
                        if (!is_dbus_visible (prop)) {
-                               continue;
+                               return true;
                        }
 
                        var info = new CCodeInitializerList ();
@@ -419,7 +424,8 @@ public class Vala.GDBusModule : GVariantModule {
                        cfile.add_constant_declaration (cdecl);
 
                        infos.append (new CCodeUnaryExpression (CCodeUnaryOperator.ADDRESS_OF, new 
CCodeIdentifier ("_" + get_ccode_lower_case_prefix (sym) + "dbus_property_info_" + prop.name)));
-               }
+                       return true;
+               });
 
                infos.append (new CCodeConstant ("NULL"));
 
diff --git a/codegen/valagdbusservermodule.vala b/codegen/valagdbusservermodule.vala
index daf2a62..f5c456e 100644
--- a/codegen/valagdbusservermodule.vala
+++ b/codegen/valagdbusservermodule.vala
@@ -94,19 +94,19 @@ public class Vala.GDBusServerModule : GDBusClientModule {
                                ccode.add_declaration ("gint", new CCodeVariableDeclarator.zero ("_fd_index", 
new CCodeConstant ("0")));
                        }
 
-                       foreach (Parameter param in m.get_parameters ()) {
+                       m.get_parameters ().foreach ((param) => {
                                string param_name = get_variable_cname (param.name);
                                if (param.direction != ParameterDirection.IN) {
-                                       continue;
+                                       return true;
                                }
 
                                if (param.variable_type is ObjectType && 
param.variable_type.data_type.get_full_name () == "GLib.Cancellable") {
-                                       continue;
+                                       return true;
                                }
 
                                if (param.variable_type is ObjectType && 
param.variable_type.data_type.get_full_name () == "GLib.BusName") {
                                        // ignore BusName sender parameters
-                                       continue;
+                                       return true;
                                }
 
                                var owned_type = param.variable_type.copy ();
@@ -146,15 +146,16 @@ public class Vala.GDBusServerModule : GDBusClientModule {
 
                                        ccode.close ();
                                }
-                       }
+                               return true;
+                       });
                }
 
-               foreach (Parameter param in m.get_parameters ()) {
+               m.get_parameters ().foreach ((param) => {
                        string param_name = get_variable_cname (param.name);
                        if (param.direction == ParameterDirection.IN && !ready) {
                                if (param.variable_type is ObjectType && 
param.variable_type.data_type.get_full_name () == "GLib.Cancellable") {
                                        ccall.add_argument (new CCodeConstant ("NULL"));
-                                       continue;
+                                       return true;
                                }
 
                                if (param.variable_type is ObjectType && 
param.variable_type.data_type.get_full_name () == "GLib.BusName") {
@@ -162,7 +163,7 @@ public class Vala.GDBusServerModule : GDBusClientModule {
                                        var sender = new CCodeFunctionCall (new CCodeIdentifier 
("g_dbus_method_invocation_get_sender"));
                                        sender.add_argument (new CCodeIdentifier ("invocation"));
                                        ccall.add_argument (sender);
-                                       continue;
+                                       return true;
                                }
 
                                var st = param.variable_type.data_type as Struct;
@@ -187,7 +188,8 @@ public class Vala.GDBusServerModule : GDBusClientModule {
                                        }
                                }
                        }
-               }
+                       return true;
+               });
 
                if (!m.coroutine || ready) {
                        if (!(m.return_type is VoidType)) {
@@ -259,9 +261,9 @@ public class Vala.GDBusServerModule : GDBusClientModule {
                                ccode.add_assignment (new CCodeIdentifier ("_fd_list"), new CCodeFunctionCall 
(new CCodeIdentifier ("g_unix_fd_list_new")));
                        }
 
-                       foreach (Parameter param in m.get_parameters ()) {
+                       m.get_parameters ().foreach ((param) => {
                                if (param.direction != ParameterDirection.OUT) {
-                                       continue;
+                                       return true;
                                }
 
                                string param_name = get_variable_cname (param.name);
@@ -280,7 +282,8 @@ public class Vala.GDBusServerModule : GDBusClientModule {
                                }
 
                                send_dbus_value (param.variable_type, new CCodeIdentifier ("_reply_builder"), 
new CCodeIdentifier (param_name), param);
-                       }
+                               return true;
+                       });
 
                        if (!(m.return_type is VoidType)) {
                                if (m.return_type.is_real_non_null_struct_type ()) {
@@ -338,16 +341,16 @@ public class Vala.GDBusServerModule : GDBusClientModule {
                        ccode.add_expression (ccall);
                }
 
-               foreach (Parameter param in m.get_parameters ()) {
+               m.get_parameters ().foreach ((param) => {
                        if ((param.direction == ParameterDirection.IN && !ready) ||
                            (param.direction == ParameterDirection.OUT && !no_reply && (!m.coroutine || 
ready))) {
                                if (param.variable_type is ObjectType && 
param.variable_type.data_type.get_full_name () == "GLib.Cancellable") {
-                                       continue;
+                                       return true;
                                }
 
                                if (param.variable_type is ObjectType && 
param.variable_type.data_type.get_full_name () == "GLib.BusName") {
                                        // ignore BusName sender parameters
-                                       continue;
+                                       return true;
                                }
 
                                var owned_type = param.variable_type.copy ();
@@ -359,7 +362,8 @@ public class Vala.GDBusServerModule : GDBusClientModule {
                                        ccode.add_expression (destroy_local (local));
                                }
                        }
-               }
+                       return true;
+               });
 
                if (!no_reply && (!m.coroutine || ready)) {
                        var return_value = new CCodeFunctionCall (new CCodeIdentifier 
("g_dbus_connection_send_message"));
@@ -401,7 +405,7 @@ public class Vala.GDBusServerModule : GDBusClientModule {
 
                function.add_parameter (new CCodeParameter ("_sender", "GObject*"));
 
-               foreach (var param in sig.get_parameters ()) {
+               sig.get_parameters ().foreach ((param) => {
                        // ensure ccodenode of parameter is set
                        var cparam = generate_parameter (param, cfile, new HashMap<int,CCodeParameter> (), 
null);
 
@@ -412,7 +416,8 @@ public class Vala.GDBusServerModule : GDBusClientModule {
                                        function.add_parameter (new CCodeParameter 
(get_parameter_array_length_cname (param, dim), "int"));
                                }
                        }
-               }
+                       return true;
+               });
 
                function.add_parameter (new CCodeParameter ("_data", "gpointer*"));
 
@@ -428,14 +433,15 @@ public class Vala.GDBusServerModule : GDBusClientModule {
                builder_init.add_argument (new CCodeIdentifier ("G_VARIANT_TYPE_TUPLE"));
                ccode.add_expression (builder_init);
 
-               foreach (Parameter param in sig.get_parameters ()) {
+               sig.get_parameters ().foreach ((param) => {
                        string param_name = get_variable_cname (param.name);
                        CCodeExpression expr = new CCodeIdentifier (param_name);
                        if (param.variable_type.is_real_struct_type ()) {
                                expr = new CCodeUnaryExpression (CCodeUnaryOperator.POINTER_INDIRECTION, 
expr);
                        }
                        write_expression (param.variable_type, new CCodeIdentifier ("_arguments_builder"), 
expr, param);
-               }
+                       return true;
+               });
 
                var builder_end = new CCodeFunctionCall (new CCodeIdentifier ("g_variant_builder_end"));
                builder_end.add_argument (new CCodeUnaryExpression (CCodeUnaryOperator.ADDRESS_OF, new 
CCodeIdentifier ("_arguments_builder")));
@@ -571,12 +577,12 @@ public class Vala.GDBusServerModule : GDBusClientModule {
                        return;
                }
 
-               foreach (Signal sig in sym.get_signals ()) {
+               sym.get_signals ().foreach ((sig) => {
                        if (sig.access != SymbolAccessibility.PUBLIC) {
-                               continue;
+                               return true;
                        }
                        if (!is_dbus_visible (sig)) {
-                               continue;
+                               return true;
                        }
 
                        if (connect) {
@@ -594,7 +600,8 @@ public class Vala.GDBusServerModule : GDBusClientModule {
                                disconnect_call.add_argument (new CCodeIdentifier ("data"));
                                ccode.add_expression (disconnect_call);
                        }
-               }
+                       return true;
+               });
        }
 
        void generate_interface_method_call_function (ObjectTypeSymbol sym) {
@@ -617,13 +624,13 @@ public class Vala.GDBusServerModule : GDBusClientModule {
 
                bool first = true;
 
-               foreach (Method m in sym.get_methods ()) {
+               sym.get_methods ().foreach ((m) => {
                        if (m is CreationMethod || m.binding != MemberBinding.INSTANCE
                            || m.overrides || m.access != SymbolAccessibility.PUBLIC) {
-                               continue;
+                               return true;
                        }
                        if (!is_dbus_visible (m)) {
-                               continue;
+                               return true;
                        }
 
                        cfile.add_include ("string.h");
@@ -644,7 +651,8 @@ public class Vala.GDBusServerModule : GDBusClientModule {
                        ccall.add_argument (new CCodeIdentifier ("parameters"));
                        ccall.add_argument (new CCodeIdentifier ("invocation"));
                        ccode.add_expression (ccall);
-               }
+                       return true;
+               });
 
                if (!first) {
                        ccode.add_else ();
@@ -686,16 +694,16 @@ public class Vala.GDBusServerModule : GDBusClientModule {
 
                bool firstif = true;
 
-               foreach (Property prop in sym.get_properties ()) {
+               sym.get_properties ().foreach ((prop) => {
                        if (prop.binding != MemberBinding.INSTANCE
                            || prop.overrides || prop.access != SymbolAccessibility.PUBLIC) {
-                               continue;
+                               return true;
                        }
                        if (!is_dbus_visible (prop)) {
-                               continue;
+                               return true;
                        }
                        if (prop.get_accessor == null) {
-                               continue;
+                               return true;
                        }
 
                        cfile.add_include ("string.h");
@@ -716,7 +724,8 @@ public class Vala.GDBusServerModule : GDBusClientModule {
                        ccall.add_argument (new CCodeIdentifier ("object"));
 
                        ccode.add_return (ccall);
-               }
+                       return true;
+               });
                if (!firstif) {
                        ccode.close ();
                }
@@ -750,16 +759,16 @@ public class Vala.GDBusServerModule : GDBusClientModule {
 
                bool firstif = true;
 
-               foreach (Property prop in sym.get_properties ()) {
+               sym.get_properties ().foreach ((prop) => {
                        if (prop.binding != MemberBinding.INSTANCE
                            || prop.overrides || prop.access != SymbolAccessibility.PUBLIC) {
-                               continue;
+                               return true;
                        }
                        if (!is_dbus_visible (prop)) {
-                               continue;
+                               return true;
                        }
                        if (prop.set_accessor == null) {
-                               continue;
+                               return true;
                        }
 
                        cfile.add_include ("string.h");
@@ -782,7 +791,8 @@ public class Vala.GDBusServerModule : GDBusClientModule {
 
                        ccode.add_expression (ccall);
                        ccode.add_return (new CCodeConstant ("TRUE"));
-               }
+                       return true;
+               });
                if (!firstif) {
                        ccode.close ();
                }
diff --git a/codegen/valagerrormodule.vala b/codegen/valagerrormodule.vala
index 041779b..80ca95b 100644
--- a/codegen/valagerrormodule.vala
+++ b/codegen/valagerrormodule.vala
@@ -35,14 +35,15 @@ public class Vala.GErrorModule : CCodeDelegateModule {
 
                var cenum = new CCodeEnum (get_ccode_name (edomain));
 
-               foreach (ErrorCode ecode in edomain.get_codes ()) {
+               edomain.get_codes ().foreach ((ecode) => {
                        if (ecode.value == null) {
                                cenum.add_value (new CCodeEnumValue (get_ccode_name (ecode)));
                        } else {
                                ecode.value.emit (this);
                                cenum.add_value (new CCodeEnumValue (get_ccode_name (ecode), get_cvalue 
(ecode.value)));
                        }
-               }
+                       return true;
+               });
 
                decl_space.add_type_definition (cenum);
 
@@ -187,31 +188,34 @@ public class Vala.GErrorModule : CCodeDelegateModule {
                        }
 
                        var error_types = new ArrayList<DataType> ();
-                       foreach (DataType node_error_type in node.get_error_types ()) {
+                       node.get_error_types ().foreach ((node_error_type) => {
                                error_types.add (node_error_type);
-                       }
+                               return true;
+                       });
 
                        bool has_general_catch_clause = false;
 
                        if (!is_in_catch) {
                                var handled_error_types = new ArrayList<DataType> ();
-                               foreach (CatchClause clause in current_try.get_catch_clauses ()) {
+                               current_try.get_catch_clauses ().foreach ((clause) => {
                                        // keep track of unhandled error types
-                                       foreach (DataType node_error_type in error_types) {
+                                       error_types.foreach ((node_error_type) => {
                                                if (clause.error_type == null || node_error_type.compatible 
(clause.error_type)) {
                                                        handled_error_types.add (node_error_type);
                                                }
-                                       }
-                                       foreach (DataType handled_error_type in handled_error_types) {
+                                               return true;
+                                       });
+                                       handled_error_types.foreach ((handled_error_type) => {
                                                error_types.remove (handled_error_type);
-                                       }
+                                               return true;
+                                       });
                                        handled_error_types.clear ();
 
                                        if (clause.error_type.equals (gerror_type)) {
                                                // general catch clause, this should be the last one
                                                has_general_catch_clause = true;
                                                ccode.add_goto (clause.clabel_name);
-                                               break;
+                                               return false;
                                        } else {
                                                var catch_type = clause.error_type as ErrorType;
 
@@ -236,7 +240,8 @@ public class Vala.GErrorModule : CCodeDelegateModule {
                                                ccode.add_goto (clause.clabel_name);
                                                ccode.close ();
                                        }
-                               }
+                                       return true;
+                               });
                        }
 
                        if (has_general_catch_clause) {
@@ -258,11 +263,11 @@ public class Vala.GErrorModule : CCodeDelegateModule {
                        // current method can fail, propagate error
                        CCodeBinaryExpression ccond = null;
 
-                       foreach (DataType error_type in current_method.get_error_types ()) {
+                       current_method.get_error_types ().foreach ((error_type) => {
                                // If GLib.Error is allowed we propagate everything
                                if (error_type.equals (gerror_type)) {
                                        ccond = null;
-                                       break;
+                                       return false;
                                }
 
                                // Check the allowed error domains to propagate
@@ -273,7 +278,8 @@ public class Vala.GErrorModule : CCodeDelegateModule {
                                } else {
                                        ccond = new CCodeBinaryExpression (CCodeBinaryOperator.OR, ccond, 
domain_check);
                                }
-                       }
+                               return true;
+                       });
 
                        if (ccond != null) {
                                ccode.open_if (ccond);
@@ -305,19 +311,21 @@ public class Vala.GErrorModule : CCodeDelegateModule {
                current_try_id = this_try_id;
                is_in_catch = true;
 
-               foreach (CatchClause clause in stmt.get_catch_clauses ()) {
+               stmt.get_catch_clauses ().foreach ((clause) => {
                        clause.clabel_name = "__catch%d_%s".printf (this_try_id, get_ccode_lower_case_name 
(clause.error_type));
-               }
+                       return true;
+               });
 
                is_in_catch = false;
                stmt.body.emit (this);
                is_in_catch = true;
 
-               foreach (CatchClause clause in stmt.get_catch_clauses ()) {
+               stmt.get_catch_clauses ().foreach ((clause) => {
                        current_catch = clause;
                        ccode.add_goto ("__finally%d".printf (this_try_id));
                        clause.emit (this);
-               }
+                       return true;
+               });
 
                current_try = old_try;
                current_try_id = old_try_id;
diff --git a/codegen/valagirwriter.vala b/codegen/valagirwriter.vala
index 5ed1556..6e9cae4 100644
--- a/codegen/valagirwriter.vala
+++ b/codegen/valagirwriter.vala
@@ -126,12 +126,13 @@ public class Vala.GIRWriter : CodeVisitor {
        private ArrayList<GIRNamespace?> externals = new ArrayList<GIRNamespace?> ((a, b) => { return a.equal 
(b); });
 
        public void write_includes() {
-               foreach (var i in externals) {
+               externals.foreach ((i) => {
                        if (i.ns != this.gir_namespace) {
                                write_indent_stream ();
                                stream.printf ("<include name=\"%s\" version=\"%s\"/>\n", i.ns, i.version);
                        }
-               }
+                       return true;
+               });
        }
 
 
@@ -183,15 +184,17 @@ public class Vala.GIRWriter : CodeVisitor {
                stream.puts (buffer.str);
                stream = null;
 
-               foreach (var ns in unannotated_namespaces) {
+               unannotated_namespaces.foreach ((ns) => {
                        if (!our_namespaces.contains(ns)) {
                                Report.warning (ns.source_reference, "Namespace %s does not have a GIR 
namespace and version annotation".printf (ns.name));
                        }
-               }
-               foreach (var ns in our_namespaces) {
+                       return true;
+               });
+               our_namespaces.foreach ((ns) => {
                        ns.source_reference.file.gir_namespace = gir_namespace;
                        ns.source_reference.file.gir_version = gir_version;
-               }
+                       return true;
+               });
 
                if (our_namespaces.size == 0) {
                        Report.error (null, "No suitable namespace found to export for GIR");
@@ -325,13 +328,14 @@ public class Vala.GIRWriter : CodeVisitor {
                        write_doc (get_class_comment (cl));
 
                        // write implemented interfaces
-                       foreach (DataType base_type in cl.get_base_types ()) {
+                       cl.get_base_types ().foreach ((base_type) => {
                                var object_type = (ObjectType) base_type;
                                if (object_type.type_symbol is Interface) {
                                        write_indent ();
                                        buffer.append_printf ("<implements name=\"%s\"/>\n", gi_type_name 
(object_type.type_symbol));
                                }
-                       }
+                               return true;
+                       });
 
                        write_annotations (cl);
 
@@ -377,7 +381,7 @@ public class Vala.GIRWriter : CodeVisitor {
                        write_indent ();
                        buffer.append_printf ("</field>\n");
 
-                       foreach (Method m in cl.get_methods ()) {
+                       cl.get_methods ().foreach ((m) => {
                                if (m.is_abstract || m.is_virtual) {
                                        write_indent ();
                                        if (m.coroutine) {
@@ -412,9 +416,10 @@ public class Vala.GIRWriter : CodeVisitor {
                                                buffer.append_printf ("</field>\n");
                                        }
                                }
-                       }
+                               return true;
+                       });
 
-                       foreach (Signal sig in cl.get_signals ()) {
+                       cl.get_signals ().foreach ((sig) => {
                                if (sig.default_handler != null) {
                                        write_indent ();
                                        buffer.append_printf ("<field name=\"%s\">\n", sig.name);
@@ -424,7 +429,8 @@ public class Vala.GIRWriter : CodeVisitor {
                                        write_indent ();
                                        buffer.append_printf ("</field>\n");
                                }
-                       }
+                               return true;
+                       });
 
                        indent--;
                        write_indent ();
@@ -518,10 +524,11 @@ public class Vala.GIRWriter : CodeVisitor {
 
                // write prerequisites
                if (iface.get_prerequisites ().size > 0) {
-                       foreach (DataType base_type in iface.get_prerequisites ()) {
+                       iface.get_prerequisites ().foreach ((base_type) => {
                                write_indent ();
                                buffer.append_printf ("<prerequisite name=\"%s\"/>\n", gi_type_name 
(((ObjectType) base_type).type_symbol));
-                       }
+                               return true;
+                       });
                }
 
                write_annotations (iface);
@@ -550,7 +557,7 @@ public class Vala.GIRWriter : CodeVisitor {
                write_indent ();
                buffer.append_printf ("</field>\n");
 
-               foreach (Method m in iface.get_methods ()) {
+               iface.get_methods ().foreach ((m) => {
                        if (m.is_abstract || m.is_virtual) {
                                if (m.coroutine) {
                                        string finish_name = m.name;
@@ -584,9 +591,10 @@ public class Vala.GIRWriter : CodeVisitor {
                                        buffer.append_printf ("</field>\n");
                                }
                        }
-               }
+                       return true;
+               });
 
-               foreach (var prop in iface.get_properties ()) {
+               iface.get_properties ().foreach ((prop) => {
                        if (prop.is_abstract || prop.is_virtual) {
                                if (prop.get_accessor != null) {
                                        var m = prop.get_accessor.get_method ();
@@ -610,7 +618,8 @@ public class Vala.GIRWriter : CodeVisitor {
                                        buffer.append_printf ("</field>\n");
                                }
                        }
-               }
+                       return true;
+               });
 
                indent--;
                write_indent ();
@@ -623,9 +632,10 @@ public class Vala.GIRWriter : CodeVisitor {
                var nodes = this.deferred;
                this.deferred = new ArrayList<Vala.CodeNode>();
 
-               foreach (var node in nodes) {
+               nodes.foreach ((node) => {
                        node.accept (this);
-               }
+                       return true;
+               });
        }
 
        private string? get_gir_name (Symbol symbol) {
@@ -873,11 +883,12 @@ public class Vala.GIRWriter : CodeVisitor {
                                index++;
                        }
 
-                       foreach (Parameter param in params) {
+                       params.foreach ((param) => {
                                index++;
 
                                skip_implicit_params (param.variable_type, ref index, 
CCodeBaseModule.get_ccode_array_length (param));
-                       }
+                               return true;
+                       });
 
                        if (ret_is_struct) {
                                index++;
@@ -904,11 +915,12 @@ public class Vala.GIRWriter : CodeVisitor {
                                write_param_or_return (instance_type, true, ref index, false, "self");
                        }
 
-                       foreach (Parameter param in params) {
+                       params.foreach ((param) => {
                                write_param_or_return (param.variable_type, true, ref index, 
CCodeBaseModule.get_ccode_array_length (param), param.name, get_parameter_comment (param), param.direction);
 
                                write_implicit_params (param.variable_type, ref index, 
CCodeBaseModule.get_ccode_array_length (param), param.name, param.direction);
-                       }
+                               return true;
+                       });
 
                        if (ret_is_struct) {
                                // struct returns are converted to parameters
@@ -1238,9 +1250,10 @@ public class Vala.GIRWriter : CodeVisitor {
 
                if ((type.value_owned && delegate_type == null) || (constructor && 
!type.data_type.is_subtype_of (ginitiallyunowned_type))) {
                        var any_owned = false;
-                       foreach (var generic_arg in type.get_type_arguments ()) {
+                       type.get_type_arguments ().foreach ((generic_arg) => {
                                any_owned |= generic_arg.value_owned;
-                       }
+                               return true;
+                       });
                        if (type.has_type_arguments () && !any_owned) {
                                buffer.append_printf (" transfer-ownership=\"container\"");
                        } else {
@@ -1340,9 +1353,10 @@ public class Vala.GIRWriter : CodeVisitor {
                                buffer.append_printf (">\n");
                                indent++;
 
-                               foreach (DataType type_argument in type_arguments) {
+                               type_arguments.foreach ((type_argument) => {
                                        write_type (type_argument);
-                               }
+                                       return true;
+                               });
 
                                indent--;
                                write_indent ();
@@ -1365,7 +1379,7 @@ public class Vala.GIRWriter : CodeVisitor {
        private void write_annotations (CodeNode node) {
                foreach (Attribute attr in node.attributes) {
                        string name = camel_case_to_canonical (attr.name);
-                       foreach (string arg_name in attr.args.keys) {
+                       attr.args.keys.foreach ((arg_name) => {
                                string value = attr.args.get (arg_name);
                                if (value.has_prefix ("\"")) {
                                        // eval string
@@ -1375,7 +1389,8 @@ public class Vala.GIRWriter : CodeVisitor {
                                write_indent ();
                                buffer.append_printf ("<attribute name=\"%s.%s\" value=\"%s\"/>\n",
                                        name, camel_case_to_canonical (arg_name), value);
-                       }
+                               return true;
+                       });
                }
        }
 
diff --git a/codegen/valagobjectmodule.vala b/codegen/valagobjectmodule.vala
index 33bb878..2f9ae12 100644
--- a/codegen/valagobjectmodule.vala
+++ b/codegen/valagobjectmodule.vala
@@ -74,7 +74,7 @@ public class Vala.GObjectModule : GTypeModule {
                }
 
                /* create type, dup_func, and destroy_func properties for generic types */
-               foreach (TypeParameter type_param in cl.get_type_parameters ()) {
+               cl.get_type_parameters ().foreach ((type_param) => {
                        string func_name, enum_value;
                        CCodeConstant func_name_constant;
                        CCodeFunctionCall cinst, cspec;
@@ -129,13 +129,14 @@ public class Vala.GObjectModule : GTypeModule {
                        cinst.add_argument (cspec);
                        ccode.add_expression (cinst);
                        prop_enum.add_value (new CCodeEnumValue (enum_value));
-               }
+                       return true;
+               });
 
                /* create properties */
                var props = cl.get_properties ();
-               foreach (Property prop in props) {
+               props.foreach ((prop) => {
                        if (!is_gobject_property (prop)) {
-                               continue;
+                               return true;
                        }
 
                        if (prop.comment != null) {
@@ -148,25 +149,20 @@ public class Vala.GObjectModule : GTypeModule {
                        cinst.add_argument (get_param_spec (prop));
 
                        ccode.add_expression (cinst);
-               }
+                       return true;
+               });
        }
 
        private bool class_has_readable_properties (Class cl) {
-               foreach (Property prop in cl.get_properties ()) {
-                       if (prop.get_accessor != null) {
-                               return true;
-                       }
-               }
-               return false;
+               return !cl.get_properties ().foreach ((prop) => {
+                       return (prop.get_accessor == null);
+               });
        }
 
        private bool class_has_writable_properties (Class cl) {
-               foreach (Property prop in cl.get_properties ()) {
-                       if (prop.set_accessor != null) {
-                               return true;
-                       }
-               }
-               return false;
+               return !cl.get_properties ().foreach ((prop) => {
+                       return (prop.set_accessor == null);
+               });
        }
 
        private void add_guarded_expression (Symbol sym, CCodeExpression expression) {
@@ -195,13 +191,13 @@ public class Vala.GObjectModule : GTypeModule {
 
                ccode.open_switch (new CCodeIdentifier ("property_id"));
                var props = cl.get_properties ();
-               foreach (Property prop in props) {
+               props.foreach ((prop) => {
                        if (prop.get_accessor == null || prop.is_abstract) {
-                               continue;
+                               return true;
                        }
                        if (!is_gobject_property (prop)) {
                                // don't register private properties
-                               continue;
+                               return true;
                        }
 
                        Property base_prop = prop;
@@ -275,7 +271,8 @@ public class Vala.GObjectModule : GTypeModule {
                                }
                        }
                        ccode.add_break ();
-               }
+                       return true;
+               });
                ccode.add_default ();
                emit_invalid_property_id_warn ();
                ccode.add_break ();
@@ -303,12 +300,12 @@ public class Vala.GObjectModule : GTypeModule {
 
                ccode.open_switch (new CCodeIdentifier ("property_id"));
                var props = cl.get_properties ();
-               foreach (Property prop in props) {
+               props.foreach ((prop) => {
                        if (prop.set_accessor == null || prop.is_abstract) {
-                               continue;
+                               return true;
                        }
                        if (!is_gobject_property (prop)) {
-                               continue;
+                               return true;
                        }
 
                        Property base_prop = prop;
@@ -367,10 +364,11 @@ public class Vala.GObjectModule : GTypeModule {
                                add_guarded_expression (prop, ccall);
                        }
                        ccode.add_break ();
-               }
+                       return true;
+               });
 
                /* type, dup func, and destroy func properties for generic types */
-               foreach (TypeParameter type_param in cl.get_type_parameters ()) {
+               cl.get_type_parameters ().foreach ((type_param) => {
                        string func_name, enum_value;
                        CCodeMemberAccess cfield;
                        CCodeFunctionCall cgetcall;
@@ -401,7 +399,8 @@ public class Vala.GObjectModule : GTypeModule {
                        cgetcall.add_argument (new CCodeIdentifier ("value"));
                        ccode.add_assignment (cfield, cgetcall);
                        ccode.add_break ();
-               }
+                       return true;
+               });
                ccode.add_default ();
                emit_invalid_property_id_warn ();
                ccode.add_break ();
@@ -783,26 +782,27 @@ public class Vala.GObjectModule : GTypeModule {
                        } else if (ma.symbol_reference == gobject_type) {
                                // Object (...) chain up
                                // check it's only used with valid properties
-                               foreach (var arg in expr.get_argument_list ()) {
+                               expr.get_argument_list ().foreach ((arg) => {
                                        var named_argument = arg as NamedArgument;
                                        if (named_argument == null) {
                                                Report.error (arg.source_reference, "Named argument 
expected");
-                                               break;
+                                               return false;
                                        }
                                        var prop = SemanticAnalyzer.symbol_lookup_inherited (current_class, 
named_argument.name) as Property;
                                        if (prop == null) {
                                                Report.error (arg.source_reference, "Property `%s' not found 
in `%s'".printf (named_argument.name, current_class.get_full_name ()));
-                                               break;
+                                               return false;
                                        }
                                        if (!is_gobject_property (prop)) {
                                                Report.error (arg.source_reference, "Property `%s' not 
supported in Object (property: value) constructor chain up".printf (named_argument.name));
-                                               break;
+                                               return false;
                                        }
                                        if (!arg.value_type.compatible (prop.property_type)) {
                                                Report.error (arg.source_reference, "Cannot convert from `%s' 
to `%s'".printf (arg.value_type.to_string (), prop.property_type.to_string ()));
-                                               break;
+                                               return false;
                                        }
-                               }
+                                       return true;
+                               });
                        }
 
                        pop_line ();
diff --git a/codegen/valagsignalmodule.vala b/codegen/valagsignalmodule.vala
index f995f27..3911293 100644
--- a/codegen/valagsignalmodule.vala
+++ b/codegen/valagsignalmodule.vala
@@ -41,9 +41,10 @@ public class Vala.GSignalModule : GObjectModule {
                if (params == null || params.size == 0) {
                        ret = ret + "_VOID";
                } else {
-                       foreach (Parameter p in params) {
+                       params.foreach ((p) => {
                                ret = "%s_%s".printf (ret, get_ccode_marshaller_type_name (p).replace (",", 
"_"));
-                       }
+                               return true;
+                       });
                }
                
                return ret;
@@ -92,14 +93,15 @@ public class Vala.GSignalModule : GObjectModule {
                        signature = signature + "VOID";
                } else {
                        bool first = true;
-                       foreach (Parameter p in params) {
+                       params.foreach ((p) => {
                                if (first) {
                                        signature = signature + get_ccode_marshaller_type_name (p);
                                        first = false;
                                } else {
                                        signature = "%s,%s".printf (signature, get_ccode_marshaller_type_name 
(p));
                                }
-                       }
+                               return true;
+                       });
                }
                
                return signature;
@@ -184,9 +186,10 @@ public class Vala.GSignalModule : GObjectModule {
                sig.accept_children (this);
 
                // declare parameter type
-               foreach (Parameter p in sig.get_parameters ()) {
+               sig.get_parameters ().foreach ((p) => {
                        generate_parameter (p, cfile, new HashMap<int,CCodeParameter> (), null);
-               }
+                       return true;
+               });
 
                generate_marshaller (sig.get_parameters (), sig.return_type);
        }
@@ -216,14 +219,15 @@ public class Vala.GSignalModule : GObjectModule {
                var callback_decl = new CCodeFunctionDeclarator (get_marshaller_function (params, 
return_type, "GMarshalFunc"));
                callback_decl.add_parameter (new CCodeParameter ("data1", "gpointer"));
                n_params = 1;
-               foreach (Parameter p in params) {
+               params.foreach ((p) => {
                        callback_decl.add_parameter (new CCodeParameter ("arg_%d".printf (n_params), 
get_value_type_name_from_parameter (p)));
                        n_params++;
                        if (p.variable_type.is_array ()) {
                                callback_decl.add_parameter (new CCodeParameter ("arg_%d".printf (n_params), 
"gint"));
                                n_params++;
                        }
-               }
+                       return true;
+               });
                callback_decl.add_parameter (new CCodeParameter ("data2", "gpointer"));
                ccode.add_statement (new CCodeTypeDefinition (get_value_type_name_from_type_reference 
(return_type), callback_decl));
 
@@ -266,7 +270,7 @@ public class Vala.GSignalModule : GObjectModule {
                fc = new CCodeFunctionCall (new CCodeIdentifier ("callback"));
                fc.add_argument (new CCodeIdentifier ("data1"));
                i = 1;
-               foreach (Parameter p in params) {
+               params.foreach ((p) => {
                        string get_value_function;
                        bool is_array = p.variable_type.is_array ();
                        if (p.direction != ParameterDirection.IN) {
@@ -294,7 +298,8 @@ public class Vala.GSignalModule : GObjectModule {
                                fc.add_argument (inner_fc);
                                i++;
                        }
-               }
+                       return true;
+               });
                fc.add_argument (new CCodeIdentifier ("data2"));
                
                if (return_type.data_type != null || return_type.is_array ()) {
@@ -401,15 +406,16 @@ public class Vala.GSignalModule : GObjectModule {
                }
 
                int params_len = 0;
-               foreach (Parameter param in params) {
+               params.foreach ((param) => {
                        params_len++;
                        if (param.variable_type.is_array ()) {
                                params_len++;
                        }
-               }
+                       return true;
+               });
 
                csignew.add_argument (new CCodeConstant ("%d".printf (params_len)));
-               foreach (Parameter param in params) {
+               params.foreach ((param) => {
                        if (param.variable_type.is_array ()) {
                                if (((ArrayType) param.variable_type).element_type.data_type == 
string_type.data_type) {
                                        csignew.add_argument (new CCodeConstant ("G_TYPE_STRV"));
@@ -424,7 +430,8 @@ public class Vala.GSignalModule : GObjectModule {
                        } else {
                                csignew.add_argument (new CCodeConstant (get_ccode_type_id 
(param.variable_type.data_type)));
                        }
-               }
+                       return true;
+               });
 
                marshal_arg.name = marshaller;
 
diff --git a/codegen/valagtkmodule.vala b/codegen/valagtkmodule.vala
index 6799ee9..1a8e52f 100644
--- a/codegen/valagtkmodule.vala
+++ b/codegen/valagtkmodule.vala
@@ -44,14 +44,16 @@ public class Vala.GtkModule : GSignalModule {
        }
 
        private void recurse_cclass_to_vala_map (Namespace ns) {
-               foreach (var cl in ns.get_classes()) {
+               ns.get_classes().foreach ((cl) => {
                        if (!cl.is_compact) {
                                cclass_to_vala_map.set (get_ccode_name (cl), cl);
                        }
-               }
-               foreach (var inner in ns.get_namespaces()) {
+                       return true;
+               });
+               ns.get_namespaces().foreach ((inner) => {
                        recurse_cclass_to_vala_map (inner);
-               }
+                       return true;
+               });
        }
 
        private void ensure_gresource_to_file_map () {
diff --git a/codegen/valagtypemodule.vala b/codegen/valagtypemodule.vala
index 7024462..3945b8e 100644
--- a/codegen/valagtypemodule.vala
+++ b/codegen/valagtypemodule.vala
@@ -201,12 +201,13 @@ public class Vala.GTypeModule : GErrorModule {
                        // base class declaration
                        generate_class_struct_declaration (cl.base_class, decl_space);
                }
-               foreach (DataType base_type in cl.get_base_types ()) {
+               cl.get_base_types ().foreach ((base_type) => {
                        var iface = base_type.data_type as Interface;
                        if (iface != null) {
                                generate_interface_declaration (iface, decl_space);
                        }
-               }
+                       return true;
+               });
 
                generate_class_declaration (cl, decl_space);
 
@@ -245,19 +246,21 @@ public class Vala.GTypeModule : GErrorModule {
                        }
                }
 
-               foreach (Method m in cl.get_methods ()) {
+               cl.get_methods ().foreach ((m) => {
                        generate_virtual_method_declaration (m, decl_space, type_struct);
-               }
+                       return true;
+               });
 
-               foreach (Signal sig in cl.get_signals ()) {
+               cl.get_signals ().foreach ((sig) => {
                        if (sig.default_handler != null) {
                                generate_virtual_method_declaration (sig.default_handler, decl_space, 
type_struct);
                        }
-               }
+                       return true;
+               });
 
-               foreach (Property prop in cl.get_properties ()) {
+               cl.get_properties ().foreach ((prop) => {
                        if (!prop.is_abstract && !prop.is_virtual) {
-                               continue;
+                               return true;
                        }
                        generate_type_declaration (prop.property_type, decl_space);
 
@@ -316,9 +319,10 @@ public class Vala.GTypeModule : GErrorModule {
                                vdecl.add_declarator (vdeclarator);
                                type_struct.add_declaration (vdecl);
                        }
-               }
+                       return true;
+               });
 
-               foreach (Field f in cl.get_fields ()) {
+               cl.get_fields ().foreach ((f) => {
                        if (f.access != SymbolAccessibility.PRIVATE) {
                                CCodeModifiers modifiers = (f.is_volatile ? CCodeModifiers.VOLATILE : 0) | 
(f.version.deprecated ? CCodeModifiers.DEPRECATED : 0);
                                if (f.binding == MemberBinding.INSTANCE) {
@@ -360,7 +364,8 @@ public class Vala.GTypeModule : GErrorModule {
                                        type_struct.add_field (get_ccode_name (f.variable_type), 
get_ccode_name (f), modifiers);
                                }
                        }
-               }
+                       return true;
+               });
 
                if (!cl.is_compact || cl.base_class == null || is_gsource) {
                        // derived compact classes do not have a struct
@@ -413,7 +418,7 @@ public class Vala.GTypeModule : GErrorModule {
 
                if (is_gtypeinstance) {
                        /* create type, dup_func, and destroy_func fields for generic types */
-                       foreach (TypeParameter type_param in cl.get_type_parameters ()) {
+                       cl.get_type_parameters ().foreach ((type_param) => {
                                string func_name;
 
                                func_name = "%s_type".printf (type_param.name.down ());
@@ -424,11 +429,13 @@ public class Vala.GTypeModule : GErrorModule {
 
                                func_name = "%s_destroy_func".printf (type_param.name.down ());
                                instance_priv_struct.add_field ("GDestroyNotify", func_name);
-                       }
+                               return true;
+                       });
                }
 
-               foreach (Field f in cl.get_fields ()) {
+               cl.get_fields ().foreach ((f) => {
                        CCodeModifiers modifiers = (f.is_volatile ? CCodeModifiers.VOLATILE : 0) | 
(f.version.deprecated ? CCodeModifiers.DEPRECATED : 0);
+
                        if (f.binding == MemberBinding.INSTANCE) {
                                if (f.access == SymbolAccessibility.PRIVATE)  {
                                        generate_type_declaration (f.variable_type, decl_space);
@@ -482,9 +489,10 @@ public class Vala.GTypeModule : GErrorModule {
                                        type_priv_struct.add_field (get_ccode_name (mutex_type), 
get_symbol_lock_name (get_ccode_name (f)));
                                }
                        }
-               }
+                       return true;
+               });
 
-               foreach (Property prop in cl.get_properties ()) {
+               cl.get_properties ().foreach ((prop) => {
                        if (prop.binding == MemberBinding.INSTANCE) {
                                if (prop.get_lock_used ()) {
                                        cl.has_private_fields = true;
@@ -498,7 +506,8 @@ public class Vala.GTypeModule : GErrorModule {
                                        type_priv_struct.add_field (get_ccode_name (mutex_type), 
get_symbol_lock_name (prop.name));
                                }
                        }
-               }
+                       return true;
+               });
 
                if (is_gtypeinstance) {
                        if (cl.has_class_private_fields || has_class_locks) {
@@ -640,11 +649,12 @@ public class Vala.GTypeModule : GErrorModule {
                                add_class_finalize_function (cl);
                        }
 
-                       foreach (DataType base_type in cl.get_base_types ()) {
+                       cl.get_base_types ().foreach ((base_type) => {
                                if (base_type.data_type is Interface) {
                                        add_interface_init_function (cl, (Interface) base_type.data_type);
                                }
-                       }
+                               return true;
+                       });
                        
                        add_instance_init_function (cl);
 
@@ -1200,9 +1210,9 @@ public class Vala.GTypeModule : GErrorModule {
                }
 
                /* connect overridden methods */
-               foreach (Method m in cl.get_methods ()) {
+               cl.get_methods ().foreach ((m) => {
                        if (m.base_method == null) {
-                               continue;
+                               return true;
                        }
                        var base_type = m.base_method.parent_symbol;
 
@@ -1215,21 +1225,23 @@ public class Vala.GTypeModule : GErrorModule {
                                        ccode.add_assignment (new CCodeMemberAccess.pointer (ccast, 
get_ccode_finish_vfunc_name (m.base_method)), new CCodeIdentifier (get_ccode_finish_real_name (m)));
                                }
                        }
-               }
+                       return true;
+               });
 
                /* connect default signal handlers */
-               foreach (Signal sig in cl.get_signals ()) {
+               cl.get_signals ().foreach ((sig) => {
                        if (sig.default_handler == null) {
-                               continue;
+                               return true;
                        }
                        var ccast = new CCodeCastExpression (new CCodeIdentifier ("klass"), "%sClass 
*".printf (get_ccode_name (cl)));
                        ccode.add_assignment (new CCodeMemberAccess.pointer (ccast, get_ccode_vfunc_name 
(sig.default_handler)), new CCodeIdentifier (get_ccode_real_name (sig.default_handler)));
-               }
+                       return true;
+               });
 
                /* connect overridden properties */
-               foreach (Property prop in cl.get_properties ()) {
+               cl.get_properties ().foreach ((prop) => {
                        if (prop.base_property == null) {
-                               continue;
+                               return true;
                        }
                        var base_type = prop.base_property.parent_symbol;
                        
@@ -1246,18 +1258,20 @@ public class Vala.GTypeModule : GErrorModule {
                                        ccode.add_assignment (new CCodeMemberAccess.pointer (ccast, 
"set_%s".printf (prop.name)), new CCodeIdentifier (cname));
                                }
                        }
-               }
+                       return true;
+               });
 
                generate_class_init (cl);
 
                if (!cl.is_compact) {
                        /* create signals */
-                       foreach (Signal sig in cl.get_signals ()) {
+                       cl.get_signals ().foreach ((sig) => {
                                if (sig.comment != null) {
                                        ccode.add_statement (new CCodeComment (sig.comment.content));
                                }
                                ccode.add_expression (get_signal_creation (sig, cl));
-                       }
+                               return true;
+                       });
                }
 
                pop_context ();
@@ -1309,14 +1323,14 @@ public class Vala.GTypeModule : GErrorModule {
                ccall.add_argument (new CCodeIdentifier ("iface"));
                ccode.add_assignment (new CCodeIdentifier (parent_iface_var), ccall);
 
-               foreach (Method m in cl.get_methods ()) {
+               cl.get_methods ().foreach ((m) => {
                        if (m.base_interface_method == null) {
-                               continue;
+                               return true;
                        }
 
                        var base_type = m.base_interface_method.parent_symbol;
                        if (base_type != iface) {
-                               continue;
+                               return true;
                        }
                        
                        var ciface = new CCodeIdentifier ("iface");
@@ -1337,10 +1351,11 @@ public class Vala.GTypeModule : GErrorModule {
                                }
                                ccode.add_assignment (new CCodeMemberAccess.pointer (ciface, 
get_ccode_finish_vfunc_name (m.base_interface_method)), cfunc);
                        }
-               }
+                       return true;
+               });
 
                if (iface.get_attribute ("GenericAccessors") != null) {
-                       foreach (TypeParameter p in iface.get_type_parameters ()) {
+                       iface.get_type_parameters ().foreach ((p) => {
                                GenericType p_type = new GenericType (p);
                                DataType p_data_type = p_type.get_actual_type (get_data_type_for_symbol (cl), 
null, cl);
 
@@ -1358,11 +1373,12 @@ public class Vala.GTypeModule : GErrorModule {
                                                               "GDestroyNotify",
                                                               get_destroy_func_expression (p_data_type),
                                                               p, cl, iface);
-                       }
+                               return true;
+                       });
                }
 
                // connect inherited implementations
-               foreach (Method m in iface.get_methods ()) {
+               iface.get_methods ().foreach ((m) => {
                        if (m.is_abstract) {
                                Method cl_method = null;
                                var base_class = cl;
@@ -1388,16 +1404,17 @@ public class Vala.GTypeModule : GErrorModule {
                                        ccode.add_assignment (new CCodeMemberAccess.pointer (ciface, 
get_ccode_vfunc_name (m)), cfunc);
                                }
                        }
-               }
+                       return true;
+               });
 
-               foreach (Property prop in cl.get_properties ()) {
+               cl.get_properties ().foreach ((prop) => {
                        if (prop.base_interface_property == null) {
-                               continue;
+                               return true;
                        }
 
                        var base_type = (ObjectTypeSymbol) prop.base_interface_property.parent_symbol;
                        if (base_type != iface) {
-                               continue;
+                               return true;
                        }
                        
                        var ciface = new CCodeIdentifier ("iface");
@@ -1428,11 +1445,12 @@ public class Vala.GTypeModule : GErrorModule {
                                        ccode.add_assignment (new CCodeMemberAccess.pointer (ciface, 
"set_%s".printf (prop.name)), cfunc);
                                }
                        }
-               }
+                       return true;
+               });
 
-               foreach (Property prop in iface.get_properties ()) {
+               iface.get_properties ().foreach ((prop) => {
                        if (!prop.is_abstract) {
-                               continue;
+                               return true;
                        }
 
                        Property cl_prop = null;
@@ -1470,7 +1488,8 @@ public class Vala.GTypeModule : GErrorModule {
                                        ccode.add_assignment (new CCodeMemberAccess.pointer (ciface, 
"set_%s".printf (prop.name)), cfunc);
                                }
                        }
-               }
+                       return true;
+               });
 
                pop_function ();
                cfile.add_function (iface_init);
@@ -1899,7 +1918,7 @@ public class Vala.GTypeModule : GErrorModule {
                        return;
                }
 
-               foreach (DataType prerequisite in iface.get_prerequisites ()) {
+               iface.get_prerequisites ().foreach ((prerequisite) => {
                        var prereq_cl = prerequisite.data_type as Class;
                        var prereq_iface = prerequisite.data_type as Interface;
                        if (prereq_cl != null) {
@@ -1907,7 +1926,8 @@ public class Vala.GTypeModule : GErrorModule {
                        } else if (prereq_iface != null) {
                                generate_interface_declaration (prereq_iface, decl_space);
                        }
-               }
+                       return true;
+               });
 
                var type_struct = new CCodeStruct ("_%s".printf (get_ccode_type_name (iface)));
                
@@ -1931,7 +1951,7 @@ public class Vala.GTypeModule : GErrorModule {
                type_struct.add_field ("GTypeInterface", "parent_iface");
 
                if (iface.get_attribute ("GenericAccessors") != null) {
-                       foreach (TypeParameter p in iface.get_type_parameters ()) {
+                       iface.get_type_parameters ().foreach ((p) => {
                                string method_name = "get_%s_type".printf (p.name.down ());
                                var vdeclarator = new CCodeFunctionDeclarator (method_name);
                                var this_type = get_data_type_for_symbol (iface);
@@ -1958,10 +1978,11 @@ public class Vala.GTypeModule : GErrorModule {
                                vdecl = new CCodeDeclaration ("GDestroyNotify");
                                vdecl.add_declarator (vdeclarator);
                                type_struct.add_declaration (vdecl);
-                       }
+                               return true;
+                       });
                }
 
-               foreach (Symbol sym in iface.get_virtuals ()) {
+               iface.get_virtuals ().foreach ((sym) => {
                        Method m;
                        Signal sig;
                        Property prop;
@@ -2029,7 +2050,8 @@ public class Vala.GTypeModule : GErrorModule {
                        } else {
                                assert_not_reached ();
                        }
-               }
+                       return true;
+               });
 
                decl_space.add_type_definition (type_struct);
 
@@ -2108,10 +2130,10 @@ public class Vala.GTypeModule : GErrorModule {
                if (iface.is_subtype_of (gobject_type)) {
                        /* create properties */
                        var props = iface.get_properties ();
-                       foreach (Property prop in props) {
+                       props.foreach ((prop) => {
                                if (prop.is_abstract) {
                                        if (!is_gobject_property (prop)) {
-                                               continue;
+                                               return true;
                                        }
 
                                        if (prop.comment != null) {
@@ -2124,30 +2146,33 @@ public class Vala.GTypeModule : GErrorModule {
 
                                        ccode.add_expression (cinst);
                                }
-                       }
+                               return true;
+                       });
                }
 
                var ciface = new CCodeIdentifier ("iface");
 
                /* connect default signal handlers */
-               foreach (Signal sig in iface.get_signals ()) {
+               iface.get_signals ().foreach ((sig) => {
                        if (sig.default_handler == null) {
-                               continue;
+                               return true;
                        }
                        var cname = get_ccode_real_name (sig.default_handler);
                        ccode.add_assignment (new CCodeMemberAccess.pointer (ciface, get_ccode_vfunc_name 
(sig.default_handler)), new CCodeIdentifier (cname));
-               }
+                       return true;
+               });
 
                /* create signals */
-               foreach (Signal sig in iface.get_signals ()) {
+               iface.get_signals ().foreach ((sig) => {
                        if (sig.comment != null) {
                                ccode.add_statement (new CCodeComment (sig.comment.content));
                        }
                        ccode.add_expression (get_signal_creation (sig, iface));
-               }
+                       return true;
+               });
 
                // connect default implementations
-               foreach (Method m in iface.get_methods ()) {
+               iface.get_methods ().foreach ((m) => {
                        if (m.is_virtual) {
                                var cname = get_ccode_real_name (m);
                                ccode.add_assignment (new CCodeMemberAccess.pointer (ciface, 
get_ccode_vfunc_name (m)), new CCodeIdentifier (cname));
@@ -2155,9 +2180,10 @@ public class Vala.GTypeModule : GErrorModule {
                                        ccode.add_assignment (new CCodeMemberAccess.pointer (ciface, 
get_ccode_finish_vfunc_name (m)), new CCodeIdentifier (get_ccode_finish_real_name (m)));
                                }
                        }
-               }
+                       return true;
+               });
 
-               foreach (Property prop in iface.get_properties ()) {
+               iface.get_properties ().foreach ((prop) => {
                        if (prop.is_virtual) {
                                if (prop.get_accessor != null) {
                                        string cname = CCodeBaseModule.get_ccode_real_name 
(prop.get_accessor);
@@ -2168,7 +2194,8 @@ public class Vala.GTypeModule : GErrorModule {
                                        ccode.add_assignment (new CCodeMemberAccess.pointer (ciface, 
"set_%s".printf (prop.name)), new CCodeIdentifier (cname));
                                }
                        }
-               }
+                       return true;
+               });
 
                ccode.close ();
 
diff --git a/codegen/valagvariantmodule.vala b/codegen/valagvariantmodule.vala
index b50aca0..d5ce8b8 100644
--- a/codegen/valagvariantmodule.vala
+++ b/codegen/valagvariantmodule.vala
@@ -101,11 +101,12 @@ public class Vala.GVariantModule : GAsyncModule {
                        if (sig == null && st != null) {
                                var str = new StringBuilder ();
                                str.append_c ('(');
-                               foreach (Field f in st.get_fields ()) {
+                               st.get_fields ().foreach ((f) => {
                                        if (f.binding == MemberBinding.INSTANCE) {
                                                str.append (get_type_signature (f.variable_type, f));
                                        }
-                               }
+                                       return true;
+                               });
                                str.append_c (')');
                                sig = str.str;
                        } else if (sig == null && en != null) {
@@ -119,12 +120,13 @@ public class Vala.GVariantModule : GAsyncModule {
                        var type_args = datatype.get_type_arguments ();
                        if (sig != null && "%s" in sig && type_args.size > 0) {
                                string element_sig = "";
-                               foreach (DataType type_arg in type_args) {
+                               type_args.foreach ((type_arg) => {
                                        var s = get_type_signature (type_arg);
                                        if (s != null) {
                                                element_sig += s;
                                        }
-                               }
+                                       return true;
+                               });
 
                                sig = sig.replace ("%s", element_sig);
                        }
@@ -220,7 +222,7 @@ public class Vala.GVariantModule : GAsyncModule {
                ccode.add_declaration (get_ccode_name (en), new CCodeVariableDeclarator.zero ("value", new 
CCodeConstant ("0")));
 
                bool firstif = true;
-               foreach (EnumValue enum_value in en.get_values ()) {
+               en.get_values ().foreach ((enum_value) => {
                        string dbus_value = get_dbus_value (enum_value, enum_value.name);
                        var string_comparison = new CCodeFunctionCall (new CCodeIdentifier ("strcmp"));
                        string_comparison.add_argument (new CCodeIdentifier ("str"));
@@ -233,7 +235,8 @@ public class Vala.GVariantModule : GAsyncModule {
                                ccode.else_if (cond);
                        }
                        ccode.add_assignment (new CCodeIdentifier ("value"), new CCodeIdentifier 
(get_ccode_name (enum_value)));
-               }
+                       return true;
+               });
 
                ccode.add_else ();
                var set_error = new CCodeFunctionCall (new CCodeIdentifier ("g_set_error"));
@@ -360,15 +363,16 @@ public class Vala.GVariantModule : GAsyncModule {
 
                bool field_found = false;;
 
-               foreach (Field f in st.get_fields ()) {
+               st.get_fields ().foreach ((f) => {
                        if (f.binding != MemberBinding.INSTANCE) {
-                               continue;
+                               return true;
                        }
 
                        field_found = true;
 
                        read_expression (f.variable_type, new CCodeIdentifier (subiter_name), new 
CCodeMemberAccess (new CCodeIdentifier (temp_name), get_ccode_name (f)), f);
-               }
+                       return true;
+               });
 
                if (!field_found) {
                        return null;
@@ -555,12 +559,13 @@ public class Vala.GVariantModule : GAsyncModule {
                ccode.add_declaration ("const char *", new CCodeVariableDeclarator ("str"));
 
                ccode.open_switch (new CCodeIdentifier ("value"));
-               foreach (EnumValue enum_value in en.get_values ()) {
+               en.get_values ().foreach ((enum_value) => {
                        string dbus_value = get_dbus_value (enum_value, enum_value.name);
                        ccode.add_case (new CCodeIdentifier (get_ccode_name (enum_value)));
                        ccode.add_assignment (new CCodeIdentifier ("str"), new CCodeConstant ("\"%s\"".printf 
(dbus_value)));
                        ccode.add_break ();
-               }
+                       return true;
+               });
 
                ccode.close();
 
@@ -642,15 +647,16 @@ public class Vala.GVariantModule : GAsyncModule {
 
                bool field_found = false;;
 
-               foreach (Field f in st.get_fields ()) {
+               st.get_fields ().foreach ((f) => {
                        if (f.binding != MemberBinding.INSTANCE) {
-                               continue;
+                               return true;
                        }
 
                        field_found = true;
 
                        write_expression (f.variable_type, new CCodeIdentifier (builder_name), new 
CCodeMemberAccess (struct_expr, get_ccode_name (f)), f);
-               }
+                       return true;
+               });
 
                if (!field_found) {
                        return null;
diff --git a/codegen/valainterfaceregisterfunction.vala b/codegen/valainterfaceregisterfunction.vala
index 0b900ea..d2684f5 100644
--- a/codegen/valainterfaceregisterfunction.vala
+++ b/codegen/valainterfaceregisterfunction.vala
@@ -80,7 +80,7 @@ public class Vala.InterfaceRegisterFunction : TypeRegisterFunction {
 
        public override void get_type_interface_init_statements (CCodeBlock block, bool plugin) {
                /* register all prerequisites */
-               foreach (DataType prereq_ref in interface_reference.get_prerequisites ()) {
+               interface_reference.get_prerequisites ().foreach ((prereq_ref) => {
                        var prereq = prereq_ref.data_type;
                        
                        var func = new CCodeFunctionCall (new CCodeIdentifier 
("g_type_interface_add_prerequisite"));
@@ -88,7 +88,8 @@ public class Vala.InterfaceRegisterFunction : TypeRegisterFunction {
                        func.add_argument (new CCodeIdentifier (CCodeBaseModule.get_ccode_type_id (prereq)));
                        
                        block.add_statement (new CCodeExpressionStatement (func));
-               }
+                       return true;
+               });
 
                ((CCodeBaseModule) context.codegen).register_dbus_info (block, interface_reference);
        }
diff --git a/codegen/valatyperegisterfunction.vala b/codegen/valatyperegisterfunction.vala
index 9617f82..1622a96 100644
--- a/codegen/valatyperegisterfunction.vala
+++ b/codegen/valatyperegisterfunction.vala
@@ -157,13 +157,14 @@ public abstract class Vala.TypeRegisterFunction {
                        var clist = new CCodeInitializerList (); /* or during visit time? */
 
                        CCodeInitializerList clist_ev = null;
-                       foreach (EnumValue ev in en.get_values ()) {
+                       en.get_values ().foreach ((ev) => {
                                clist_ev = new CCodeInitializerList ();
                                clist_ev.append (new CCodeConstant (CCodeBaseModule.get_ccode_name (ev)));
                                clist_ev.append (new CCodeIdentifier ("\"%s\"".printf 
(CCodeBaseModule.get_ccode_name (ev))));
                                clist_ev.append (CCodeBaseModule.get_enum_value_canonical_cconstant (ev));
                                clist.append (clist_ev);
-                       }
+                               return true;
+                       });
 
                        clist_ev = new CCodeInitializerList ();
                        clist_ev.append (new CCodeConstant ("0"));
diff --git a/vala/valaarraycreationexpression.vala b/vala/valaarraycreationexpression.vala
index a433157..ac61c7d 100644
--- a/vala/valaarraycreationexpression.vala
+++ b/vala/valaarraycreationexpression.vala
@@ -94,9 +94,10 @@ public class Vala.ArrayCreationExpression : Expression {
                        element_type.accept (visitor);
                }
 
-               foreach (Expression e in sizes) {
+               sizes.foreach ((e) => {
                        e.accept (visitor);
-               }
+                       return true;
+               });
 
                if (initializer_list != null) {
                        initializer_list.accept (visitor);
@@ -196,9 +197,10 @@ public class Vala.ArrayCreationExpression : Expression {
                        element_type.check (context);
                }
 
-               foreach (Expression e in sizes) {
+               sizes.foreach ((e) => {
                        e.check (context);
-               }
+                       return true;
+               });
 
                var calc_sizes = new ArrayList<Literal> ();
                if (initlist != null) {
@@ -231,9 +233,10 @@ public class Vala.ArrayCreationExpression : Expression {
                                /* this is an internal error because it is already handeld by the parser */
                                Report.error (source_reference, "internal error: initializer list expected");
                        } else {
-                               foreach (Expression size in calc_sizes) {
+                               calc_sizes.foreach ((size) => {
                                        append_size (size);
-                               }
+                                       return true;
+                               });
                        }
                }
 
@@ -260,9 +263,10 @@ public class Vala.ArrayCreationExpression : Expression {
        }
 
        public override void emit (CodeGenerator codegen) {
-               foreach (Expression e in sizes) {
+               sizes.foreach ((e) => {
                        e.emit (codegen);
-               }
+                       return true;
+               });
 
                if (initializer_list != null) {
                        initializer_list.emit (codegen);
diff --git a/vala/valaassignment.vala b/vala/valaassignment.vala
index 88e45ff..ce09cd2 100644
--- a/vala/valaassignment.vala
+++ b/vala/valaassignment.vala
@@ -118,7 +118,7 @@ public class Vala.Assignment : Expression {
 
                        int i = 0;
                        ExpressionStatement stmt = null;
-                       foreach (var expr in tuple.get_expressions ()) {
+                       tuple.get_expressions ().foreach ((expr) => {
                                if (stmt != null) {
                                        stmt.check (context);
                                        insert_statement (context.analyzer.insert_block, stmt);
@@ -131,7 +131,8 @@ public class Vala.Assignment : Expression {
                                stmt = new ExpressionStatement (assign, expr.source_reference);
 
                                i++;
-                       }
+                               return true;
+                       });
 
                        context.analyzer.replaced_nodes.add (this);
                        parent_node.replace_expression (this, stmt.expression);
@@ -203,9 +204,10 @@ public class Vala.Assignment : Expression {
                                right.target_type = new DelegateType (sig.get_delegate (ma.inner.value_type, 
this));
                        } else if (ea.container.value_type.get_member ("set") is Method) {
                                var set_call = new MethodCall (new MemberAccess (ea.container, "set", 
source_reference), source_reference);
-                               foreach (Expression e in ea.get_indices ()) {
+                               ea.get_indices ().foreach ((e) => {
                                        set_call.add_argument (e);
-                               }
+                                       return true;
+                               });
                                set_call.add_argument (right);
                                parent_node.replace_expression (this, set_call);
                                return set_call.check (context);
@@ -285,14 +287,15 @@ public class Vala.Assignment : Expression {
                        var right_ma = right as MemberAccess;
                        if (dynamic_sig != null) {
                                bool first = true;
-                               foreach (Parameter param in dynamic_sig.handler.value_type.get_parameters ()) 
{
+                               dynamic_sig.handler.value_type.get_parameters ().foreach ((param) => {
                                        if (first) {
                                                // skip sender parameter
                                                first = false;
                                        } else {
                                                dynamic_sig.add_parameter (param.copy ());
                                        }
-                               }
+                                       return true;
+                               });
                                right.target_type = new DelegateType (sig.get_delegate (new ObjectType 
((ObjectTypeSymbol) sig.parent_symbol), this));
                        } else if (!right.value_type.compatible (right.target_type)) {
                                var delegate_type = (DelegateType) right.target_type;
diff --git a/vala/valabaseaccess.vala b/vala/valabaseaccess.vala
index 8058540..8d1fc87 100644
--- a/vala/valabaseaccess.vala
+++ b/vala/valabaseaccess.vala
@@ -78,12 +78,13 @@ public class Vala.BaseAccess : Expression {
                        Report.error (source_reference, "Base access invalid without base class");
                        return false;
                } else {
-                       foreach (var base_type in context.analyzer.current_class.get_base_types ()) {
+                       context.analyzer.current_class.get_base_types ().foreach ((base_type) => {
                                if (base_type.data_type is Class) {
                                        value_type = base_type.copy ();
                                        value_type.value_owned = false;
                                }
-                       }
+                               return true;
+                       });
                }
 
                symbol_reference = value_type.data_type;
diff --git a/vala/valablock.vala b/vala/valablock.vala
index 4064b6e..dd367a7 100644
--- a/vala/valablock.vala
+++ b/vala/valablock.vala
@@ -153,18 +153,21 @@ public class Vala.Block : Symbol, Statement {
                        statement_list[i].check (context);
                }
 
-               foreach (LocalVariable local in get_local_variables ()) {
+               get_local_variables ().foreach ((local) => {
                        local.active = false;
-               }
+                       return true;
+               });
 
-               foreach (Constant constant in local_constants) {
+               local_constants.foreach ((constant) => {
                        constant.active = false;
-               }
+                       return true;
+               });
 
                // use get_statements () instead of statement_list to not miss errors within StatementList 
objects
-               foreach (Statement stmt in get_statements ()) {
+               get_statements ().foreach ((stmt) => {
                        add_error_types (stmt.get_error_types ());
-               }
+                       return true;
+               });
 
                context.analyzer.current_symbol = old_symbol;
                context.analyzer.insert_block = old_insert_block;
diff --git a/vala/valaclass.vala b/vala/valaclass.vala
index b983319..4a21f41 100644
--- a/vala/valaclass.vala
+++ b/vala/valaclass.vala
@@ -462,38 +462,46 @@ public class Vala.Class : ObjectTypeSymbol {
        }
 
        public override void accept_children (CodeVisitor visitor) {
-               foreach (DataType type in base_types) {
+               base_types.foreach ((type) => {
                        type.accept (visitor);
-               }
+                       return true;
+               });
 
-               foreach (TypeParameter p in get_type_parameters ()) {
+               get_type_parameters ().foreach ((p) => {
                        p.accept (visitor);
-               }
+                       return true;
+               });
 
                /* process enums first to avoid order problems in C code */
-               foreach (Enum en in enums) {
+               enums.foreach ((en) => {
                        en.accept (visitor);
-               }
+                       return true;
+               });
 
-               foreach (Field f in fields) {
+               fields.foreach ((f) => {
                        f.accept (visitor);
-               }
+                       return true;
+               });
                
-               foreach (Constant c in constants) {
+               constants.foreach ((c) => {
                        c.accept (visitor);
-               }
+                       return true;
+               });
                
-               foreach (Method m in methods) {
+               methods.foreach ((m) => {
                        m.accept (visitor);
-               }
+                       return true;
+               });
                
-               foreach (Property prop in properties) {
+               properties.foreach ((prop) => {
                        prop.accept (visitor);
-               }
+                       return true;
+               });
                
-               foreach (Signal sig in signals) {
+               signals.foreach ((sig) => {
                        sig.accept (visitor);
-               }
+                       return true;
+               });
                
                if (constructor != null) {
                        constructor.accept (visitor);
@@ -519,17 +527,20 @@ public class Vala.Class : ObjectTypeSymbol {
                        class_destructor.accept (visitor);
                }
                
-               foreach (Class cl in classes) {
+               classes.foreach ((cl) => {
                        cl.accept (visitor);
-               }
+                       return true;
+               });
                
-               foreach (Struct st in structs) {
+               structs.foreach ((st) => {
                        st.accept (visitor);
-               }
+                       return true;
+               });
 
-               foreach (Delegate d in delegates) {
+               delegates.foreach ((d) => {
                        d.accept (visitor);
-               }
+                       return true;
+               });
        }
 
        public override bool is_reference_type () {
@@ -548,13 +559,12 @@ public class Vala.Class : ObjectTypeSymbol {
                        return true;
                }
 
-               foreach (DataType base_type in base_types) {
+               return !base_types.foreach ((base_type) => {
                        if (base_type.data_type != null && base_type.data_type.is_subtype_of (t)) {
-                               return true;
+                               return false;
                        }
-               }
-               
-               return false;
+                       return true;
+               });
        }
 
        public override void replace_type (DataType old_type, DataType new_type) {
@@ -568,19 +578,19 @@ public class Vala.Class : ObjectTypeSymbol {
        }
 
        private void get_all_prerequisites (Interface iface, List<TypeSymbol> list) {
-               foreach (DataType prereq in iface.get_prerequisites ()) {
+               iface.get_prerequisites ().foreach ((prereq) => {
                        TypeSymbol type = prereq.data_type;
                        /* skip on previous errors */
                        if (type == null) {
-                               continue;
+                               return true;
                        }
 
                        list.add (type);
                        if (type is Interface) {
                                get_all_prerequisites ((Interface) type, list);
-
                        }
-               }
+                       return true;
+               });
        }
 
        private bool class_is_a (Class cl, TypeSymbol t) {
@@ -588,17 +598,16 @@ public class Vala.Class : ObjectTypeSymbol {
                        return true;
                }
 
-               foreach (DataType base_type in cl.get_base_types ()) {
+               return !cl.get_base_types ().foreach ((base_type) => {
                        if (base_type.data_type is Class) {
                                if (class_is_a ((Class) base_type.data_type, t)) {
-                                       return true;
+                                       return false;
                                }
                        } else if (base_type.data_type == t) {
-                               return true;
+                               return false;
                        }
-               }
-
-               return false;
+                       return true;
+               });
        }
 
        public override bool check (CodeContext context) {
@@ -648,38 +657,46 @@ public class Vala.Class : ObjectTypeSymbol {
                        }
                }
 
-               foreach (DataType type in base_types) {
+               base_types.foreach ((type) => {
                        type.check (context);
-               }
+                       return true;
+               });
 
-               foreach (TypeParameter p in get_type_parameters ()) {
+               get_type_parameters ().foreach ((p) => {
                        p.check (context);
-               }
+                       return true;
+               });
 
                /* process enums first to avoid order problems in C code */
-               foreach (Enum en in enums) {
+               enums.foreach ((en) => {
                        en.check (context);
-               }
+                       return true;
+               });
 
-               foreach (Field f in fields) {
+               fields.foreach ((f) => {
                        f.check (context);
-               }
+                       return true;
+               });
                
-               foreach (Constant c in constants) {
+               constants.foreach ((c) => {
                        c.check (context);
-               }
+                       return true;
+               });
                
-               foreach (Method m in methods) {
+               methods.foreach ((m) => {
                        m.check (context);
-               }
+                       return true;
+               });
                
-               foreach (Property prop in properties) {
+               properties.foreach ((prop) => {
                        prop.check (context);
-               }
+                       return true;
+               });
                
-               foreach (Signal sig in signals) {
+               signals.foreach ((sig) => {
                        sig.check (context);
-               }
+                       return true;
+               });
                
                if (constructor != null) {
                        constructor.check (context);
@@ -705,66 +722,74 @@ public class Vala.Class : ObjectTypeSymbol {
                        class_destructor.check (context);
                }
                
-               foreach (Class cl in classes) {
+               classes.foreach ((cl) => {
                        cl.check (context);
-               }
+                       return true;
+               });
                
-               foreach (Struct st in structs) {
+               structs.foreach ((st) => {
                        st.check (context);
-               }
+                       return true;
+               });
 
-               foreach (Delegate d in delegates) {
+               delegates.foreach ((d) => {
                        d.check (context);
-               }
+                       return true;
+               });
 
                /* compact classes cannot implement interfaces */
                if (is_compact) {
-                       foreach (DataType base_type in get_base_types ()) {
+                       get_base_types ().foreach ((base_type) => {
                                if (base_type.data_type is Interface) {
                                        error = true;
                                        Report.error (source_reference, "compact classes `%s` may not 
implement interfaces".printf (get_full_name ()));
                                }
-                       }
+                               return true;
+                       });
 
                        if (!external && !external_package && base_class != null && base_class != 
context.analyzer.gsource_type) {
-                               foreach (Field f in fields) {
+                               fields.foreach ((f) => {
                                        if (f.binding == MemberBinding.INSTANCE) {
                                                error = true;
                                                Report.error (source_reference, "derived compact classes may 
not have instance fields");
-                                               break;
+                                               return false;
                                        }
-                               }
+                                       return true;
+                               });
                        }
                }
 
                /* gather all prerequisites */
                List<TypeSymbol> prerequisites = new ArrayList<TypeSymbol> ();
-               foreach (DataType base_type in get_base_types ()) {
+               get_base_types ().foreach ((base_type) => {
                        if (base_type.data_type is Interface) {
                                get_all_prerequisites ((Interface) base_type.data_type, prerequisites);
                        }
-               }
+                       return true;
+               });
                /* check whether all prerequisites are met */
                List<string> missing_prereqs = new ArrayList<string> ();
-               foreach (TypeSymbol prereq in prerequisites) {
+               prerequisites.foreach ((prereq) => {
                        if (!class_is_a (this, prereq)) {
                                missing_prereqs.insert (0, prereq.get_full_name ());
                        }
-               }
+                       return true;
+               });
                /* report any missing prerequisites */
                if (missing_prereqs.size > 0) {
                        error = true;
 
                        string error_string = "%s: some prerequisites (".printf (get_full_name ());
                        bool first = true;
-                       foreach (string s in missing_prereqs) {
+                       missing_prereqs.foreach ((s) => {
                                if (first) {
                                        error_string = "%s`%s'".printf (error_string, s);
                                        first = false;
                                } else {
                                        error_string = "%s, `%s'".printf (error_string, s);
                                }
-                       }
+                               return true;
+                       });
                        error_string += ") are not met";
                        Report.error (source_reference, error_string);
                }
@@ -772,13 +797,13 @@ public class Vala.Class : ObjectTypeSymbol {
                /* VAPI classes don't have to specify overridden methods */
                if (source_type == SourceFileType.SOURCE) {
                        /* all abstract symbols defined in base types have to be at least defined (or 
implemented) also in this type */
-                       foreach (DataType base_type in get_base_types ()) {
+                       get_base_types ().foreach ((base_type) => {
                                if (base_type.data_type is Interface) {
                                        Interface iface = (Interface) base_type.data_type;
 
                                        if (base_class != null && base_class.is_subtype_of (iface)) {
                                                // reimplementation of interface, class is not required to 
reimplement all methods
-                                               break;
+                                               return false;
                                        }
 
                                        /* We do not need to do expensive equality checking here since this 
is done
@@ -786,7 +811,7 @@ public class Vala.Class : ObjectTypeSymbol {
                                         */
 
                                        /* check methods */
-                                       foreach (Method m in iface.get_methods ()) {
+                                       iface.get_methods ().foreach ((m) => {
                                                if (m.is_abstract) {
                                                        var implemented = false;
                                                        var base_class = this;
@@ -807,10 +832,11 @@ public class Vala.Class : ObjectTypeSymbol {
                                                                Report.error (source_reference, "`%s' does 
not implement interface method `%s'".printf (get_full_name (), m.get_full_name ()));
                                                        }
                                                }
-                                       }
+                                               return true;
+                                       });
 
                                        /* check properties */
-                                       foreach (Property prop in iface.get_properties ()) {
+                                       iface.get_properties ().foreach ((prop) => {
                                                if (prop.is_abstract) {
                                                        Symbol sym = null;
                                                        var base_class = this;
@@ -827,15 +853,17 @@ public class Vala.Class : ObjectTypeSymbol {
                                                                Report.error (source_reference, "`%s' does 
not implement interface property `%s'".printf (get_full_name (), prop.get_full_name ()));
                                                        }
                                                }
-                                       }
+                                               return true;
+                                       });
                                }
-                       }
+                               return true;
+                       });
 
                        /* all abstract symbols defined in base classes have to be implemented in 
non-abstract classes */
                        if (!is_abstract) {
                                var base_class = base_class;
                                while (base_class != null && base_class.is_abstract) {
-                                       foreach (Method base_method in base_class.get_methods ()) {
+                                       base_class.get_methods ().foreach ((base_method) => {
                                                if (base_method.is_abstract) {
                                                        var override_method = 
SemanticAnalyzer.symbol_lookup_inherited (this, base_method.name) as Method;
                                                        if (override_method == null || 
!override_method.overrides) {
@@ -843,8 +871,9 @@ public class Vala.Class : ObjectTypeSymbol {
                                                                Report.error (source_reference, "`%s' does 
not implement abstract method `%s'".printf (get_full_name (), base_method.get_full_name ()));
                                                        }
                                                }
-                                       }
-                                       foreach (Property base_property in base_class.get_properties ()) {
+                                               return true;
+                                       });
+                                       base_class.get_properties ().foreach ((base_property) => {
                                                if (base_property.is_abstract) {
                                                        var override_property = 
SemanticAnalyzer.symbol_lookup_inherited (this, base_property.name) as Property;
                                                        if (override_property == null || 
!override_property.overrides) {
@@ -852,7 +881,8 @@ public class Vala.Class : ObjectTypeSymbol {
                                                                Report.error (source_reference, "`%s' does 
not implement abstract property `%s'".printf (get_full_name (), base_property.get_full_name ()));
                                                        }
                                                }
-                                       }
+                                               return true;
+                                       });
                                        base_class = base_class.base_class;
                                }
                        }
diff --git a/vala/valaclasstype.vala b/vala/valaclasstype.vala
index a0430a1..04269ea 100644
--- a/vala/valaclasstype.vala
+++ b/vala/valaclasstype.vala
@@ -43,9 +43,10 @@ public class Vala.ClassType : ReferenceType {
                result.is_dynamic = is_dynamic;
                result.floating_reference = floating_reference;
                
-               foreach (DataType arg in get_type_arguments ()) {
+               get_type_arguments ().foreach ((arg) => {
                        result.add_type_argument (arg.copy ());
-               }
+                       return true;
+               });
                
                return result;
        }
diff --git a/vala/valacodecontext.vala b/vala/valacodecontext.vala
index 0b6a0aa..d8efb21 100644
--- a/vala/valacodecontext.vala
+++ b/vala/valacodecontext.vala
@@ -581,11 +581,12 @@ public class Vala.CodeContext {
                }
 
                stream.printf ("%s:", filename);
-               foreach (var src in source_files) {
+               source_files.foreach ((src) => {
                        if (src.file_type == SourceFileType.FAST && src.used) {
                                stream.printf (" %s", src.filename);
                        }
-               }
+                       return true;
+               });
                stream.printf ("\n\n");
        }
 
diff --git a/vala/valacodenode.vala b/vala/valacodenode.vala
index 319b761..55b7526 100644
--- a/vala/valacodenode.vala
+++ b/vala/valacodenode.vala
@@ -102,9 +102,10 @@ public abstract class Vala.CodeNode {
         * or a child node 
         */
        public void add_error_types (List<DataType> error_types) {
-               foreach (DataType error_type in error_types) {
+               error_types.foreach ((error_type) => {
                        add_error_type (error_type);
-               }
+                       return true;
+               });
        }
 
        /**
diff --git a/vala/valacodewriter.vala b/vala/valacodewriter.vala
index 3872b9b..919a767 100644
--- a/vala/valacodewriter.vala
+++ b/vala/valacodewriter.vala
@@ -250,14 +250,15 @@ public class Vala.CodeWriter : CodeVisitor {
                        write_string (" : ");
                
                        bool first = true;
-                       foreach (DataType base_type in base_types) {
+                       base_types.foreach ((base_type) => {
                                if (!first) {
                                        write_string (", ");
                                } else {
                                        first = false;
                                }
                                write_type (base_type);
-                       }
+                               return true;
+                       });
                }
                write_begin_block ();
 
@@ -286,14 +287,15 @@ public class Vala.CodeWriter : CodeVisitor {
        void visit_sorted (List<Symbol> symbols) {
                if (type != CodeWriterType.EXTERNAL) {
                        // order of virtual methods matters for fast vapis
-                       foreach (Symbol sym in symbols) {
+                       symbols.foreach ((sym) => {
                                sym.accept (this);
-                       }
+                               return true;
+                       });
                        return;
                }
 
                var sorted_symbols = new ArrayList<Symbol> ();
-               foreach (Symbol sym in symbols) {
+               symbols.foreach ((sym) => {
                        int left = 0;
                        int right = sorted_symbols.size - 1;
                        if (left > right || sym.name < sorted_symbols[left].name) {
@@ -311,10 +313,12 @@ public class Vala.CodeWriter : CodeVisitor {
                                }
                                sorted_symbols.insert (left + 1, sym);
                        }
-               }
-               foreach (Symbol sym in sorted_symbols) {
+                       return true;
+               });
+               sorted_symbols.foreach ((sym) => {
                        sym.accept (this);
-               }
+                       return true;
+               });
        }
 
        public override void visit_struct (Struct st) {
@@ -348,9 +352,10 @@ public class Vala.CodeWriter : CodeVisitor {
 
                current_scope = st.scope;
 
-               foreach (Field field in st.get_fields ()) {
+               st.get_fields ().foreach ((field) => {
                        field.accept (this);
-               }
+                       return true;
+               });
                visit_sorted (st.get_constants ());
                visit_sorted (st.get_methods ());
                visit_sorted (st.get_properties ());
@@ -388,14 +393,15 @@ public class Vala.CodeWriter : CodeVisitor {
                        write_string (" : ");
                
                        bool first = true;
-                       foreach (DataType prerequisite in prerequisites) {
+                       prerequisites.foreach ((prerequisite) => {
                                if (!first) {
                                        write_string (", ");
                                } else {
                                        first = false;
                                }
                                write_type (prerequisite);
-                       }
+                               return true;
+                       });
                }
                write_begin_block ();
 
@@ -439,7 +445,7 @@ public class Vala.CodeWriter : CodeVisitor {
                write_begin_block ();
 
                bool first = true;
-               foreach (EnumValue ev in en.get_values ()) {
+               en.get_values ().foreach ((ev) => {
                        if (first) {
                                first = false;
                        } else {
@@ -460,7 +466,8 @@ public class Vala.CodeWriter : CodeVisitor {
                                write_string(" = ");
                                ev.value.accept (this);
                        }
-               }
+                       return true;
+               });
 
                if (!first) {
                        if (en.get_methods ().size > 0 || en.get_constants ().size > 0) {
@@ -470,12 +477,14 @@ public class Vala.CodeWriter : CodeVisitor {
                }
 
                current_scope = en.scope;
-               foreach (Method m in en.get_methods ()) {
+               en.get_methods ().foreach ((m) => {
                        m.accept (this);
-               }
-               foreach (Constant c in en.get_constants ()) {
+                       return true;
+               });
+               en.get_constants ().foreach ((c) => {
                        c.accept (this);
-               }
+                       return true;
+               });
                current_scope = current_scope.parent_scope;
 
                write_end_block ();
@@ -504,7 +513,7 @@ public class Vala.CodeWriter : CodeVisitor {
                write_begin_block ();
 
                bool first = true;
-               foreach (ErrorCode ecode in edomain.get_codes ()) {
+               edomain.get_codes ().foreach ((ecode) => {
                        if (first) {
                                first = false;
                        } else {
@@ -520,7 +529,8 @@ public class Vala.CodeWriter : CodeVisitor {
 
                        write_indent ();
                        write_identifier (ecode.name);
-               }
+                       return true;
+               });
 
                if (!first) {
                        if (edomain.get_methods ().size > 0) {
@@ -530,9 +540,10 @@ public class Vala.CodeWriter : CodeVisitor {
                }
 
                current_scope = edomain.scope;
-               foreach (Method m in edomain.get_methods ()) {
+               edomain.get_methods ().foreach ((m) => {
                        m.accept (this);
-               }
+                       return true;
+               });
                current_scope = current_scope.parent_scope;
 
                write_end_block ();
@@ -613,7 +624,7 @@ public class Vala.CodeWriter : CodeVisitor {
                        write_string (" throws ");
 
                        bool first = true;
-                       foreach (DataType type in error_domains) {
+                       error_domains.foreach ((type) => {
                                if (!first) {
                                        write_string (", ");
                                } else {
@@ -621,7 +632,8 @@ public class Vala.CodeWriter : CodeVisitor {
                                }
 
                                write_type (type);
-                       }
+                               return true;
+                       });
                }
        }
 
@@ -629,14 +641,14 @@ public class Vala.CodeWriter : CodeVisitor {
                write_string ("(");
 
                int i = 1;
-               foreach (Parameter param in params) {
+               params.foreach ((param) => {
                        if (i > 1) {
                                write_string (", ");
                        }
                        
                        if (param.ellipsis) {
                                write_string ("...");
-                               continue;
+                               return true;
                        }
                        
                        write_attributes (param);
@@ -672,7 +684,8 @@ public class Vala.CodeWriter : CodeVisitor {
                        }
 
                        i++;
-               }
+                       return true;
+               });
 
                write_string (")");
        }
@@ -906,9 +919,10 @@ public class Vala.CodeWriter : CodeVisitor {
        public override void visit_block (Block b) {
                write_begin_block ();
 
-               foreach (Statement stmt in b.get_statements ()) {
+               b.get_statements ().foreach ((stmt) => {
                        stmt.accept (this);
-               }
+                       return true;
+               });
 
                write_end_block ();
        }
@@ -941,7 +955,7 @@ public class Vala.CodeWriter : CodeVisitor {
                write_string ("{");
 
                bool first = true;
-               foreach (Expression initializer in list.get_initializers ()) {
+               list.get_initializers ().foreach ((initializer) => {
                        if (!first) {
                                write_string (", ");
                        } else {
@@ -949,7 +963,8 @@ public class Vala.CodeWriter : CodeVisitor {
                        }
                        first = false;
                        initializer.accept (this);
-               }
+                       return true;
+               });
                write_string (" }");
        }
 
@@ -980,9 +995,10 @@ public class Vala.CodeWriter : CodeVisitor {
                write_string (") {");
                write_newline ();
 
-               foreach (SwitchSection section in stmt.get_sections ()) {
+               stmt.get_sections ().foreach ((section) => {
                        section.accept (this);
-               }
+                       return true;
+               });
 
                write_indent ();
                write_string ("}");
@@ -990,9 +1006,10 @@ public class Vala.CodeWriter : CodeVisitor {
        }
 
        public override void visit_switch_section (SwitchSection section) {
-               foreach (SwitchLabel label in section.get_labels ()) {
+               section.get_labels ().foreach ((label) => {
                        label.accept (this);
-               }
+                       return true;
+               });
 
                visit_block (section);
        }
@@ -1042,26 +1059,28 @@ public class Vala.CodeWriter : CodeVisitor {
                write_string ("for (");
 
                bool first = true;
-               foreach (Expression initializer in stmt.get_initializer ()) {
+               stmt.get_initializer ().foreach ((initializer) => {
                        if (!first) {
                                write_string (", ");
                        }
                        first = false;
                        initializer.accept (this);
-               }
+                       return true;
+               });
                write_string ("; ");
 
                stmt.condition.accept (this);
                write_string ("; ");
 
                first = true;
-               foreach (Expression iterator in stmt.get_iterator ()) {
+               stmt.get_iterator ().foreach ((iterator) => {
                        if (!first) {
                                write_string (", ");
                        }
                        first = false;
                        iterator.accept (this);
-               }
+                       return true;
+               });
 
                write_string (")");
                stmt.body.accept (this);
@@ -1120,9 +1139,10 @@ public class Vala.CodeWriter : CodeVisitor {
                write_indent ();
                write_string ("try");
                stmt.body.accept (this);
-               foreach (var clause in stmt.get_catch_clauses ()) {
+               stmt.get_catch_clauses ().foreach ((clause) => {
                        clause.accept (this);
-               }
+                       return true;
+               });
                if (stmt.finally_body != null) {
                        write_string (" finally");
                        stmt.finally_body.accept (this);
@@ -1164,14 +1184,15 @@ public class Vala.CodeWriter : CodeVisitor {
                write_string ("[");
 
                bool first = true;
-               foreach (Expression size in expr.get_sizes ()) {
+               expr.get_sizes ().foreach ((size) => {
                        if (!first) {
                                write_string (", ");
                        }
                        first = false;
 
                        size.accept (this);
-               }
+                       return true;
+               });
 
                write_string ("]");
 
@@ -1218,14 +1239,15 @@ public class Vala.CodeWriter : CodeVisitor {
                write_string (" (");
 
                bool first = true;
-               foreach (Expression arg in expr.get_argument_list ()) {
+               expr.get_argument_list ().foreach ((arg) => {
                        if (!first) {
                                write_string (", ");
                        }
                        first = false;
 
                        arg.accept (this);
-               }
+                       return true;
+               });
 
                write_string (")");
        }
@@ -1235,14 +1257,15 @@ public class Vala.CodeWriter : CodeVisitor {
                write_string ("[");
 
                bool first = true;
-               foreach (Expression index in expr.get_indices ()) {
+               expr.get_indices ().foreach ((index) => {
                        if (!first) {
                                write_string (", ");
                        }
                        first = false;
 
                        index.accept (this);
-               }
+                       return true;
+               });
 
                write_string ("]");
        }
@@ -1284,14 +1307,15 @@ public class Vala.CodeWriter : CodeVisitor {
                write_string (" (");
 
                bool first = true;
-               foreach (Expression arg in expr.get_argument_list ()) {
+               expr.get_argument_list ().foreach ((arg) => {
                        if (!first) {
                                write_string (", ");
                        }
                        first = false;
 
                        arg.accept (this);
-               }
+                       return true;
+               });
 
                write_string (")");
        }
@@ -1465,7 +1489,7 @@ public class Vala.CodeWriter : CodeVisitor {
                write_string ("(");
                var params = expr.get_parameters ();
                int i = 1;
-               foreach (var param in params) {
+               params.foreach ((param) => {
                        if (i > 1) {
                                write_string (", ");
                        }
@@ -1479,7 +1503,8 @@ public class Vala.CodeWriter : CodeVisitor {
                        write_identifier (param.name);
 
                        i++;
-               }
+                       return true;
+               });
                write_string (") =>");
                if (expr.statement_body != null) {
                        expr.statement_body.accept (this);
@@ -1728,14 +1753,15 @@ public class Vala.CodeWriter : CodeVisitor {
                if (type_params.size > 0) {
                        write_string ("<");
                        bool first = true;
-                       foreach (TypeParameter type_param in type_params) {
+                       type_params.foreach ((type_param) => {
                                if (first) {
                                        first = false;
                                } else {
                                        write_string (",");
                                }
                                write_identifier (type_param.name);
-                       }
+                               return true;
+                       });
                        write_string (">");
                }
        }
diff --git a/vala/valaconstructor.vala b/vala/valaconstructor.vala
index d16fc13..d16dbca 100644
--- a/vala/valaconstructor.vala
+++ b/vala/valaconstructor.vala
@@ -77,11 +77,12 @@ public class Vala.Constructor : Subroutine {
                        body.check (context);
                }
 
-               foreach (DataType body_error_type in body.get_error_types ()) {
+               body.get_error_types ().foreach ((body_error_type) => {
                        if (!((ErrorType) body_error_type).dynamic_error) {
                                Report.warning (body_error_type.source_reference, "unhandled error 
`%s'".printf (body_error_type.to_string()));
                        }
-               }
+                       return true;
+           });
 
                context.analyzer.current_symbol = context.analyzer.current_symbol.parent_symbol;
 
diff --git a/vala/valacreationmethod.vala b/vala/valacreationmethod.vala
index 451dd81..3140a40 100644
--- a/vala/valacreationmethod.vala
+++ b/vala/valacreationmethod.vala
@@ -56,21 +56,25 @@ public class Vala.CreationMethod : Method {
        }
 
        public override void accept_children (CodeVisitor visitor) {
-               foreach (Parameter param in get_parameters()) {
+               get_parameters ().foreach ((param) => {
                        param.accept (visitor);
-               }
+                       return true;
+               });
 
-               foreach (DataType error_type in get_error_types ()) {
+               get_error_types ().foreach ((error_type) => {
                        error_type.accept (visitor);
-               }
+                       return true;
+               });
 
-               foreach (Expression precondition in get_preconditions ()) {
+               get_preconditions ().foreach ((precondition) => {
                        precondition.accept (visitor);
-               }
+                       return true;
+               });
 
-               foreach (Expression postcondition in get_postconditions ()) {
+               get_postconditions ().foreach ((postcondition) => {
                        postcondition.accept (visitor);
-               }
+                       return true;
+               });
 
                if (body != null) {
                        body.accept (visitor);
@@ -99,21 +103,25 @@ public class Vala.CreationMethod : Method {
                }
                context.analyzer.current_symbol = this;
 
-               foreach (Parameter param in get_parameters()) {
+               get_parameters().foreach ((param) => {
                        param.check (context);
-               }
+                       return true;
+               });
 
-               foreach (DataType error_type in get_error_types ()) {
+               get_error_types ().foreach ((error_type) => {
                        error_type.check (context);
-               }
+                       return true;
+               });
 
-               foreach (Expression precondition in get_preconditions ()) {
+               get_preconditions ().foreach ((precondition) => {
                        precondition.check (context);
-               }
+                       return true;
+               });
 
-               foreach (Expression postcondition in get_postconditions ()) {
+               get_postconditions ().foreach ((postcondition) => {
                        postcondition.check (context);
-               }
+                       return true;
+               });
 
                if (body != null) {
                        body.check (context);
@@ -165,17 +173,19 @@ public class Vala.CreationMethod : Method {
 
                // check that all errors that can be thrown in the method body are declared
                if (body != null) {
-                       foreach (DataType body_error_type in body.get_error_types ()) {
+                       body.get_error_types ().foreach ((body_error_type) => {
                                bool can_propagate_error = false;
-                               foreach (DataType method_error_type in get_error_types ()) {
+                               get_error_types ().foreach ((method_error_type) => {
                                        if (body_error_type.compatible (method_error_type)) {
                                                can_propagate_error = true;
                                        }
-                               }
+                                       return true;
+                               });
                                if (!can_propagate_error && !((ErrorType) body_error_type).dynamic_error) {
                                        Report.warning (body_error_type.source_reference, "unhandled error 
`%s'".printf (body_error_type.to_string()));
                                }
-                       }
+                               return true;
+                       });
                }
 
                return !error;
diff --git a/vala/valadatatype.vala b/vala/valadatatype.vala
index f3f9bf9..647afd2 100644
--- a/vala/valadatatype.vala
+++ b/vala/valadatatype.vala
@@ -110,10 +110,11 @@ public abstract class Vala.DataType : CodeNode {
        }
 
        public override void accept_children (CodeVisitor visitor) {
-               if (type_argument_list != null && type_argument_list.size > 0) {
-                       foreach (DataType type_arg in type_argument_list) {
+               if (type_argument_list != null) {
+                       type_argument_list.foreach ((type_arg) => {
                                type_arg.accept (visitor);
-                       }
+                               return true;
+                       });
                }
        }
 
@@ -152,7 +153,7 @@ public abstract class Vala.DataType : CodeNode {
                if (type_args.size > 0) {
                        s += "<";
                        bool first = true;
-                       foreach (DataType type_arg in type_args) {
+                       type_args.foreach ((type_arg) => {
                                if (!first) {
                                        s += ",";
                                } else {
@@ -162,7 +163,8 @@ public abstract class Vala.DataType : CodeNode {
                                        s += "weak ";
                                }
                                s += type_arg.to_qualified_string (scope);
-                       }
+                               return true;
+                       });
                        s += ">";
                }
                if (nullable) {
diff --git a/vala/valadeclarationstatement.vala b/vala/valadeclarationstatement.vala
index f0a3d41..ede2abd 100644
--- a/vala/valadeclarationstatement.vala
+++ b/vala/valadeclarationstatement.vala
@@ -73,13 +73,14 @@ public class Vala.DeclarationStatement : CodeNode, Statement {
 
                var local = declaration as LocalVariable;
                if (local != null && local.initializer != null) {
-                       foreach (DataType error_type in local.initializer.get_error_types ()) {
+                       local.initializer.get_error_types ().foreach ((error_type) => {
                                // ensure we can trace back which expression may throw errors of this type
                                var initializer_error_type = error_type.copy ();
                                initializer_error_type.source_reference = local.initializer.source_reference;
 
                                add_error_type (initializer_error_type);
-                       }
+                               return true;
+                       });
                }
 
                return !error;
diff --git a/vala/valadelegate.vala b/vala/valadelegate.vala
index 6f4ae3b..7a74b48 100644
--- a/vala/valadelegate.vala
+++ b/vala/valadelegate.vala
@@ -186,19 +186,11 @@ public class Vala.Delegate : TypeSymbol, Callable {
                }
 
                // method may throw less but not more errors than the delegate
-               foreach (DataType method_error_type in m.get_error_types ()) {
-                       bool match = false;
-                       foreach (DataType delegate_error_type in get_error_types ()) {
-                               if (method_error_type.compatible (delegate_error_type)) {
-                                       match = true;
-                                       break;
-                               }
-                       }
-
-                       if (!match) {
-                               return false;
-                       }
-               }
+               m.get_error_types ().foreach ((method_error_type) => {
+                       return get_error_types ().foreach ((delegate_error_type) => {
+                               return !(method_error_type.compatible (delegate_error_type));
+                       });
+               });
 
                return true;
        }
@@ -208,19 +200,22 @@ public class Vala.Delegate : TypeSymbol, Callable {
        }
 
        public override void accept_children (CodeVisitor visitor) {
-               foreach (TypeParameter p in type_parameters) {
+               type_parameters.foreach ((p) => {
                        p.accept (visitor);
-               }
+                       return true;
+               });
                
                return_type.accept (visitor);
                
-               foreach (Parameter param in parameters) {
+               parameters.foreach ((param) => {
                        param.accept (visitor);
-               }
+                       return true;
+               });
 
-               foreach (DataType error_type in get_error_types ()) {
+               get_error_types ().foreach ((error_type) => {
                        error_type.accept (visitor);
-               }
+                       return true;
+               });
        }
 
        public override bool is_reference_type () {
@@ -259,7 +254,7 @@ public class Vala.Delegate : TypeSymbol, Callable {
                string str = "(";
 
                int i = 1;
-               foreach (Parameter param in parameters) {
+               parameters.foreach ((param) => {
                        if (i > 1) {
                                str += ", ";
                        }
@@ -282,7 +277,8 @@ public class Vala.Delegate : TypeSymbol, Callable {
                        str += param.variable_type.to_string ();
 
                        i++;
-               }
+                       return true;
+               });
 
                str += ")";
 
@@ -302,19 +298,22 @@ public class Vala.Delegate : TypeSymbol, Callable {
                        context.analyzer.current_source_file = source_reference.file;
                }
 
-               foreach (TypeParameter p in type_parameters) {
+               type_parameters.foreach ((p) => {
                        p.check (context);
-               }
+                       return true;
+               });
                
                return_type.check (context);
                
-               foreach (Parameter param in parameters) {
+               parameters.foreach ((param) => {
                        param.check (context);
-               }
+                       return true;
+               });
 
-               foreach (DataType error_type in get_error_types ()) {
+               get_error_types ().foreach ((error_type) => {
                        error_type.check (context);
-               }
+                       return true;
+               });
 
                context.analyzer.current_source_file = old_source_file;
 
diff --git a/vala/valadelegatetype.vala b/vala/valadelegatetype.vala
index 11ba57f..706cabe 100644
--- a/vala/valadelegatetype.vala
+++ b/vala/valadelegatetype.vala
@@ -74,7 +74,7 @@ public class Vala.DelegateType : DataType {
                if (type_args.size > 0) {
                        s += "<";
                        bool first = true;
-                       foreach (DataType type_arg in type_args) {
+                       type_args.foreach ((type_arg) => {
                                if (!first) {
                                        s += ",";
                                } else {
@@ -84,7 +84,8 @@ public class Vala.DelegateType : DataType {
                                        s += "weak ";
                                }
                                s += type_arg.to_qualified_string (scope);
-                       }
+                               return true;
+                       });
                        s += ">";
                }
                if (nullable) {
@@ -99,9 +100,10 @@ public class Vala.DelegateType : DataType {
                result.value_owned = value_owned;
                result.nullable = nullable;
 
-               foreach (DataType arg in get_type_arguments ()) {
+               get_type_arguments ().foreach ((arg) => {
                        result.add_type_argument (arg.copy ());
-               }
+                       return true;
+               });
 
                result.is_called_once = is_called_once;
 
diff --git a/vala/valaelementaccess.vala b/vala/valaelementaccess.vala
index 4fb44b8..d832ec2 100644
--- a/vala/valaelementaccess.vala
+++ b/vala/valaelementaccess.vala
@@ -70,9 +70,10 @@ public class Vala.ElementAccess : Expression {
 
        public override void accept_children (CodeVisitor visitor) {
                container.accept (visitor);
-               foreach (Expression e in indices) {
+               indices.foreach ((e) => {
                        e.accept (visitor);
-               }
+                       return true;
+               });
        }
 
        public override void replace_expression (Expression old_node, Expression new_node) {
@@ -88,12 +89,10 @@ public class Vala.ElementAccess : Expression {
        }
 
        public override bool is_pure () {
-               foreach (Expression index in indices) {
-                       if (!index.is_pure ()) {
-                               return false;
-                       }
-               }
-               return container.is_pure ();
+               bool indices_pure = indices.foreach ((index) => {
+                       return index.is_pure ();
+               });
+               return indices_pure && container.is_pure ();
        }
 
        public override bool is_accessible (Symbol sym) {
@@ -135,9 +134,10 @@ public class Vala.ElementAccess : Expression {
                        get_indices ().get (0).target_type = context.analyzer.string_type.copy ();
                }
 
-               foreach (Expression index in get_indices ()) {
+               get_indices ().foreach ((index) => {
                        index.check (context);
-               }
+                       return true;
+               });
 
                bool index_int_type_check = true;
 
@@ -187,9 +187,10 @@ public class Vala.ElementAccess : Expression {
                                var get_method = container.value_type.get_member ("get") as Method;
                                if (get_method != null) {
                                        var get_call = new MethodCall (new MemberAccess (container, "get", 
source_reference), source_reference);
-                                       foreach (Expression e in get_indices ()) {
+                                       get_indices ().foreach ((e) => {
                                                get_call.add_argument (e);
-                                       }
+                                               return true;
+                                       });
                                        get_call.formal_target_type = this.formal_target_type;
                                        get_call.target_type = this.target_type;
                                        parent_node.replace_expression (this, get_call);
@@ -222,9 +223,10 @@ public class Vala.ElementAccess : Expression {
 
        public override void emit (CodeGenerator codegen) {
                container.emit (codegen);
-               foreach (Expression e in indices) {
+               indices.foreach ((e) => {
                        e.emit (codegen);
-               }
+                       return true;
+               });
 
                codegen.visit_element_access (this);
 
@@ -233,15 +235,17 @@ public class Vala.ElementAccess : Expression {
 
        public override void get_defined_variables (Collection<Variable> collection) {
                container.get_defined_variables (collection);
-               foreach (Expression index in indices) {
+               indices.foreach ((index) => {
                        index.get_defined_variables (collection);
-               }
+                       return true;
+               });
        }
 
        public override void get_used_variables (Collection<Variable> collection) {
                container.get_used_variables (collection);
-               foreach (Expression index in indices) {
+               indices.foreach ((index) => {
                        index.get_used_variables (collection);
-               }
+                       return true;
+               });
        }
 }
diff --git a/vala/valaenum.vala b/vala/valaenum.vala
index acb8eb3..94a69e4 100644
--- a/vala/valaenum.vala
+++ b/vala/valaenum.vala
@@ -139,17 +139,20 @@ public class Vala.Enum : TypeSymbol {
        }
 
        public override void accept_children (CodeVisitor visitor) {
-               foreach (EnumValue value in values) {
+               values.foreach ((value) => {
                        value.accept (visitor);
-               }
+                       return true;
+               });
 
-               foreach (Method m in methods) {
+               methods.foreach ((m) => {
                        m.accept (visitor);
-               }
+                       return true;
+               });
 
-               foreach (Constant c in constants) {
+               constants.foreach ((c) => {
                        c.accept (visitor);
-               }
+                       return true;
+               });
        }
 
        public override bool is_reference_type () {
@@ -171,17 +174,20 @@ public class Vala.Enum : TypeSymbol {
                }
                context.analyzer.current_symbol = this;
 
-               foreach (EnumValue value in values) {
+               values.foreach ((value) => {
                        value.check (context);
-               }
+                       return true;
+               });
 
-               foreach (Method m in methods) {
+               methods.foreach ((m) => {
                        m.check (context);
-               }
+                       return true;
+               });
 
-               foreach (Constant c in constants) {
+               constants.foreach ((c) => {
                        c.check (context);
-               }
+                       return true;
+               });
 
                context.analyzer.current_source_file = old_source_file;
                context.analyzer.current_symbol = old_symbol;
diff --git a/vala/valaerrordomain.vala b/vala/valaerrordomain.vala
index a73dcf8..1c1ae45 100644
--- a/vala/valaerrordomain.vala
+++ b/vala/valaerrordomain.vala
@@ -94,13 +94,15 @@ public class Vala.ErrorDomain : TypeSymbol {
        }
 
        public override void accept_children (CodeVisitor visitor) {
-               foreach (ErrorCode ecode in codes) {
+               codes.foreach ((ecode) => {
                        ecode.accept (visitor);
-               }
+                       return true;
+               });
 
-               foreach (Method m in methods) {
+               methods.foreach ((m) => {
                        m.accept (visitor);
-               }
+                       return true;
+               });
        }
 
        public override bool is_reference_type () {
@@ -114,13 +116,15 @@ public class Vala.ErrorDomain : TypeSymbol {
 
                checked = true;
 
-               foreach (ErrorCode ecode in codes) {
+               codes.foreach ((ecode) => {
                        ecode.check (context);
-               }
+                       return true;
+               });
 
-               foreach (Method m in methods) {
+               methods.foreach ((m) => {
                        m.check (context);
-               }
+                       return true;
+               });
 
                return !error;
        }
diff --git a/vala/valaflowanalyzer.vala b/vala/valaflowanalyzer.vala
index 9652c15..d27c097 100644
--- a/vala/valaflowanalyzer.vala
+++ b/vala/valaflowanalyzer.vala
@@ -106,12 +106,12 @@ public class Vala.FlowAnalyzer : CodeVisitor {
                this.context = context;
 
                /* we're only interested in non-pkg source files */
-               var source_files = context.get_source_files ();
-               foreach (SourceFile file in source_files) {
+               context.get_source_files ().foreach ((file) => {
                        if (file.file_type == SourceFileType.SOURCE) {
                                file.accept (this);
                        }
-               }
+                       return true;
+               });
        }
 
        public override void visit_source_file (SourceFile source_file) {
@@ -195,13 +195,14 @@ public class Vala.FlowAnalyzer : CodeVisitor {
 
                if (m is Method) {
                        // ensure out parameters are defined at end of method
-                       foreach (var param in ((Method) m).get_parameters ()) {
+                       ((Method) m).get_parameters ().foreach ((param) => {
                                if (param.direction == ParameterDirection.OUT) {
                                        var param_ma = new MemberAccess.simple (param.name, 
param.source_reference);
                                        param_ma.symbol_reference = param;
                                        m.return_block.add_node (param_ma);
                                }
-                       }
+                               return true;
+                       });
                }
 
                current_block = new BasicBlock ();
@@ -250,9 +251,10 @@ public class Vala.FlowAnalyzer : CodeVisitor {
                        return;
                }
                current.postorder_visited = true;
-               foreach (BasicBlock succ in current.get_successors ()) {
+               current.get_successors ().foreach ((succ) => {
                        depth_first_traverse (succ, list);
-               }
+                       return true;
+               });
                current.postorder_number = list.size;
                list.insert (0, current);
        }
@@ -265,15 +267,15 @@ public class Vala.FlowAnalyzer : CodeVisitor {
                bool changed = true;
                while (changed) {
                        changed = false;
-                       foreach (BasicBlock block in block_list) {
+                       block_list.foreach ((block) => {
                                if (block == entry_block) {
-                                       continue;
+                                       return true;
                                }
 
                                // new immediate dominator
                                BasicBlock new_idom = null;
                                bool first = true;
-                               foreach (BasicBlock pred in block.get_predecessors ()) {
+                               block.get_predecessors ().foreach ((pred) => {
                                        if (idoms[pred.postorder_number] != null) {
                                                if (first) {
                                                        new_idom = pred;
@@ -282,22 +284,23 @@ public class Vala.FlowAnalyzer : CodeVisitor {
                                                        new_idom = intersect (idoms, pred, new_idom);
                                                }
                                        }
-                               }
+                                       return true;
+                               });
                                if (idoms[block.postorder_number] != new_idom) {
                                        idoms[block.postorder_number] = new_idom;
                                        changed = true;
                                }
-                       }
+                               return true;
+                       });
                }
 
                // build tree
-               foreach (BasicBlock block in block_list) {
-                       if (block == entry_block) {
-                               continue;
+               block_list.foreach ((block) => {
+                       if (block != entry_block) {
+                               idoms[block.postorder_number].add_child (block);
                        }
-
-                       idoms[block.postorder_number].add_child (block);
-               }
+                       return true;
+               });
        }
 
        BasicBlock intersect (BasicBlock[] idoms, BasicBlock b1, BasicBlock b2) {
@@ -316,41 +319,47 @@ public class Vala.FlowAnalyzer : CodeVisitor {
                for (int i = block_list.size - 1; i >= 0; i--) {
                        var block = block_list[i];
 
-                       foreach (BasicBlock succ in block.get_successors ()) {
+                       block.get_successors ().foreach ((succ) => {
                                // if idom(succ) != block
                                if (succ.parent != block) {
                                        block.add_dominator_frontier (succ);
                                }
-                       }
+                               return true;
+                       });
 
-                       foreach (BasicBlock child in block.get_children ()) {
-                               foreach (BasicBlock child_frontier in child.get_dominator_frontier ()) {
+                       block.get_children ().foreach ((child) => {
+                               child.get_dominator_frontier ().foreach ((child_frontier) => {
                                        // if idom(child_frontier) != block
                                        if (child_frontier.parent != block) {
                                                block.add_dominator_frontier (child_frontier);
                                        }
-                               }
-                       }
+                                       return true;
+                               });
+                               return true;
+                       });
                }
        }
 
        Map<Variable, Set<BasicBlock>> get_assignment_map (List<BasicBlock> block_list, BasicBlock 
entry_block) {
                var map = new HashMap<Variable, Set<BasicBlock>> ();
-               foreach (BasicBlock block in block_list) {
+               block_list.foreach ((block) => {
                        var defined_variables = new ArrayList<Variable> ();
-                       foreach (CodeNode node in block.get_nodes ()) {
+                       block.get_nodes ().foreach ((node) => {
                                node.get_defined_variables (defined_variables);
-                       }
+                               return true;
+                       });
 
-                       foreach (Variable variable in defined_variables) {
+                       defined_variables.foreach ((variable) => {
                                var block_set = map.get (variable);
                                if (block_set == null) {
                                        block_set = new HashSet<BasicBlock> ();
                                        map.set (variable, block_set);
                                }
                                block_set.add (block);
-                       }
-               }
+                               return true;
+                       });
+                       return true;
+               });
                return map;
        }
 
@@ -362,21 +371,23 @@ public class Vala.FlowAnalyzer : CodeVisitor {
 
                var added = new HashMap<BasicBlock, int> ();
                var phi = new HashMap<BasicBlock, int> ();
-               foreach (BasicBlock block in block_list) {
+               block_list.foreach ((block) => {
                        added.set (block, 0);
                        phi.set (block, 0);
-               }
+                       return true;
+               });
 
-               foreach (Variable variable in assign.keys) {
+               assign.keys.foreach ((variable) => {
                        counter++;
-                       foreach (BasicBlock block in assign.get (variable)) {
+                       assign.get (variable).foreach ((block) => {
                                work_list.add (block);
                                added.set (block, counter);
-                       }
+                               return true;
+                       });
                        while (work_list.size > 0) {
                                BasicBlock block = work_list.get (0);
                                work_list.remove_at (0);
-                               foreach (BasicBlock frontier in block.get_dominator_frontier ()) {
+                               block.get_dominator_frontier ().foreach ((frontier) => {
                                        int blockPhi = phi.get (frontier);
                                        if (blockPhi < counter) {
                                                frontier.add_phi_function (new PhiFunction (variable, 
frontier.get_predecessors ().size));
@@ -387,9 +398,11 @@ public class Vala.FlowAnalyzer : CodeVisitor {
                                                        work_list.add (frontier);
                                                }
                                        }
-                               }
+                                       return true;
+                               });
                        }
-               }
+                       return true;
+               });
        }
 
        void check_variables (BasicBlock entry_block) {
@@ -401,16 +414,17 @@ public class Vala.FlowAnalyzer : CodeVisitor {
 
                // check for variables used before initialization
                var used_vars_queue = new ArrayList<Variable> ();
-               foreach (Variable variable in used_vars) {
+               used_vars.foreach ((variable) => {
                        used_vars_queue.add (variable);
-               }
+                       return true;
+               });
                while (used_vars_queue.size > 0) {
                        Variable used_var = used_vars_queue[0];
                        used_vars_queue.remove_at (0);
 
                        PhiFunction phi = phi_functions.get (used_var);
                        if (phi != null) {
-                               foreach (Variable variable in phi.operands) {
+                               phi.operands.foreach ((variable) => {
                                        if (variable == null) {
                                                if (used_var is LocalVariable) {
                                                        Report.error (used_var.source_reference, "use of 
possibly unassigned local variable `%s'".printf (used_var.name));
@@ -418,30 +432,32 @@ public class Vala.FlowAnalyzer : CodeVisitor {
                                                        // parameter
                                                        Report.warning (used_var.source_reference, "use of 
possibly unassigned parameter `%s'".printf (used_var.name));
                                                }
-                                               continue;
+                                               return true;
                                        }
                                        if (!(variable in used_vars)) {
                                                variable.source_reference = used_var.source_reference;
                                                used_vars.add (variable);
                                                used_vars_queue.add (variable);
                                        }
-                               }
+                                       return true;
+                               });
                        }
                }
        }
 
        void check_block_variables (BasicBlock block) {
-               foreach (PhiFunction phi in block.get_phi_functions ()) {
+               block.get_phi_functions ().foreach ((phi) => {
                        Variable versioned_var = process_assignment (var_map, phi.original_variable);
 
                        phi_functions.set (versioned_var, phi);
-               }
+                       return true;
+               });
 
-               foreach (CodeNode node in block.get_nodes ()) {
+               block.get_nodes ().foreach ((node) => {
                        var used_variables = new ArrayList<Variable> ();
                        node.get_used_variables (used_variables);
                        
-                       foreach (Variable var_symbol in used_variables) {
+                       used_variables.foreach ((var_symbol) => {
                                var variable_stack = var_map.get (var_symbol);
                                if (variable_stack == null || variable_stack.size == 0) {
                                        if (var_symbol is LocalVariable) {
@@ -450,57 +466,67 @@ public class Vala.FlowAnalyzer : CodeVisitor {
                                                // parameter
                                                Report.warning (node.source_reference, "use of possibly 
unassigned parameter `%s'".printf (var_symbol.name));
                                        }
-                                       continue;
+                                       return true;
                                }
                                var versioned_variable = variable_stack.get (variable_stack.size - 1);
                                if (!(versioned_variable in used_vars)) {
                                        versioned_variable.source_reference = node.source_reference;
                                }
                                used_vars.add (versioned_variable);
-                       }
+                               return true;
+                       });
 
                        var defined_variables = new ArrayList<Variable> ();
                        node.get_defined_variables (defined_variables);
 
-                       foreach (Variable variable in defined_variables) {
+                       defined_variables.foreach ((variable) => {
                                process_assignment (var_map, variable);
-                       }
-               }
+                               return true;
+                       });
+                       return true;
+               });
 
-               foreach (BasicBlock succ in block.get_successors ()) {
+               block.get_successors ().foreach ((succ) => {
                        int j = 0;
-                       foreach (BasicBlock pred in succ.get_predecessors ()) {
+                       succ.get_predecessors ().foreach ((pred) => {
                                if (pred == block) {
-                                       break;
+                                       return false;
                                }
                                j++;
-                       }
+                               return true;
+                       });
 
-                       foreach (PhiFunction phi in succ.get_phi_functions ()) {
+                       succ.get_phi_functions ().foreach ((phi) => {
                                var variable_stack = var_map.get (phi.original_variable);
                                if (variable_stack != null && variable_stack.size > 0) {
                                        phi.operands.set (j, variable_stack.get (variable_stack.size - 1));
                                }
-                       }
-               }
+                               return true;
+                       });
+                       return true;
+               });
 
-               foreach (BasicBlock child in block.get_children ()) {
+               block.get_children ().foreach ((child) => {
                        check_block_variables (child);
-               }
+                       return true;
+               });
 
-               foreach (PhiFunction phi in block.get_phi_functions ()) {
+               block.get_phi_functions ().foreach ((phi) => {
                        var variable_stack = var_map.get (phi.original_variable);
                        variable_stack.remove_at (variable_stack.size - 1);
-               }
-               foreach (CodeNode node in block.get_nodes ()) {
+                       return true;
+               });
+               block.get_nodes ().foreach ((node) => {
                        var defined_variables = new ArrayList<Variable> ();
                        node.get_defined_variables (defined_variables);
 
-                       foreach (Variable variable in defined_variables) {
+                       defined_variables.foreach ((variable) => {
                                var variable_stack = var_map.get (variable);
                                variable_stack.remove_at (variable_stack.size - 1);
-                       }
-               }
+                               return true;
+                       });
+                       return true;
+               });
        }
 
        Variable process_assignment (Map<Symbol, List<Variable>> var_map, Variable var_symbol) {
@@ -658,12 +684,13 @@ public class Vala.FlowAnalyzer : CodeVisitor {
 
                bool has_default_label = false;
 
-               foreach (SwitchSection section in stmt.get_sections ()) {
+               stmt.get_sections ().foreach ((section) => {
                        current_block = new BasicBlock ();
                        condition_block.connect (current_block);
-                       foreach (Statement section_stmt in section.get_statements ()) {
+                       section.get_statements ().foreach ((section_stmt) => {
                                section_stmt.accept (this);
-                       }
+                               return true;
+                       });
 
                        if (section.has_default_label ()) {
                                has_default_label = true;
@@ -678,7 +705,8 @@ public class Vala.FlowAnalyzer : CodeVisitor {
 
                                current_block.connect (after_switch_block);
                        }
-               }
+                       return true;
+           });
 
                if (!has_default_label) {
                        condition_block.connect (after_switch_block);
@@ -845,7 +873,7 @@ public class Vala.FlowAnalyzer : CodeVisitor {
                        var last_block = current_block;
 
                        // exceptional control flow
-                       foreach (DataType error_data_type in node.get_error_types()) {
+                       node.get_error_types().foreach ((error_data_type) => {
                                var error_type = error_data_type as ErrorType;
                                current_block = last_block;
                                unreachable_reported = true;
@@ -880,7 +908,8 @@ public class Vala.FlowAnalyzer : CodeVisitor {
                                                current_block = jump_target.last_block;
                                        }
                                }
-                       }
+                               return true;
+                       });
 
                        // normal control flow
                        if (!always_fail) {
diff --git a/vala/valaforeachstatement.vala b/vala/valaforeachstatement.vala
index 4de3f52..9761f21 100644
--- a/vala/valaforeachstatement.vala
+++ b/vala/valaforeachstatement.vala
@@ -369,9 +369,10 @@ public class Vala.ForeachStatement : Block {
 
                body.check (context);
 
-               foreach (LocalVariable local in get_local_variables ()) {
+               get_local_variables ().foreach ((local) => {
                        local.active = false;
-               }
+                       return true;
+               });
 
                context.analyzer.current_symbol = context.analyzer.current_symbol.parent_symbol;
 
diff --git a/vala/valaforstatement.vala b/vala/valaforstatement.vala
index ab80af5..0a5eb1e 100644
--- a/vala/valaforstatement.vala
+++ b/vala/valaforstatement.vala
@@ -117,10 +117,11 @@ public class Vala.ForStatement : CodeNode, Statement {
        }
        
        public override void accept_children (CodeVisitor visitor) {
-               foreach (Expression init_expr in initializer) {
+               initializer.foreach ((init_expr) => {
                        init_expr.accept (visitor);
                        visitor.visit_end_full_expression (init_expr);
-               }
+                       return true;
+               });
 
                if (condition != null) {
                        condition.accept (visitor);
@@ -128,10 +129,11 @@ public class Vala.ForStatement : CodeNode, Statement {
                        visitor.visit_end_full_expression (condition);
                }
 
-               foreach (Expression it_expr in iterator) {
+               iterator.foreach ((it_expr) => {
                        it_expr.accept (visitor);
                        visitor.visit_end_full_expression (it_expr);
-               }
+                       return true;
+               });
                
                body.accept (visitor);
        }
@@ -152,9 +154,10 @@ public class Vala.ForStatement : CodeNode, Statement {
                var block = new Block (source_reference);
 
                // initializer
-               foreach (var init_expr in initializer) {
+               initializer.foreach ((init_expr) => {
                        block.add_statement (new ExpressionStatement (init_expr, init_expr.source_reference));
-               }
+                       return true;
+               });
 
                // do not generate if block if condition is always true
                if (condition == null || always_true (condition)) {
@@ -175,9 +178,10 @@ public class Vala.ForStatement : CodeNode, Statement {
                block.add_statement (new DeclarationStatement (first_local, source_reference));
 
                var iterator_block = new Block (source_reference);
-               foreach (var it_expr in iterator) {
+               iterator.foreach ((it_expr) => {
                        iterator_block.add_statement (new ExpressionStatement (it_expr, 
it_expr.source_reference));
-               }
+                       return true;
+               });
 
                var first_if = new IfStatement (new UnaryExpression (UnaryOperator.LOGICAL_NEGATION, new 
MemberAccess.simple (first_local.name, source_reference), source_reference), iterator_block, null, 
source_reference);
                body.insert_statement (0, first_if);
diff --git a/vala/valagenieparser.vala b/vala/valagenieparser.vala
index ce9a504..7b5aa09 100644
--- a/vala/valagenieparser.vala
+++ b/vala/valagenieparser.vala
@@ -536,9 +536,10 @@ public class Vala.Genie.Parser : CodeVisitor {
 
                        type = new UnresolvedType.from_symbol (sym, get_src (begin));
                        if (type_arg_list != null) {
-                               foreach (DataType type_arg in type_arg_list) {
+                               type_arg_list.foreach ((type_arg) => {
                                        type.add_type_argument (type_arg);
-                               }
+                                       return true;
+                               });
                        }
                }
                
@@ -751,9 +752,10 @@ public class Vala.Genie.Parser : CodeVisitor {
                List<DataType> type_arg_list = parse_type_argument_list (true);
                var expr = new MemberAccess (null, id, get_src (begin));
                if (type_arg_list != null) {
-                       foreach (DataType type_arg in type_arg_list) {
+                       type_arg_list.foreach ((type_arg) => {
                                expr.add_type_argument (type_arg);
-                       }
+                               return true;
+                       });
                }
                return expr;
        }
@@ -784,9 +786,10 @@ public class Vala.Genie.Parser : CodeVisitor {
                expect (TokenType.CLOSE_PARENS);
                if (expr_list.size != 1) {
                        var tuple = new Tuple ();
-                       foreach (Expression expr in expr_list) {
+                       expr_list.foreach ((expr) => {
                                tuple.add_expression (expr);
-                       }
+                               return true;
+                       });
                        return tuple;
                }
                return expr_list.get (0);
@@ -798,9 +801,10 @@ public class Vala.Genie.Parser : CodeVisitor {
                List<DataType> type_arg_list = parse_type_argument_list (true);
                var expr = new MemberAccess (inner, id, get_src (begin));
                if (type_arg_list != null) {
-                       foreach (DataType type_arg in type_arg_list) {
+                       type_arg_list.foreach ((type_arg) => {
                                expr.add_type_argument (type_arg);
-                       }
+                               return true;
+                       });
                }
                return expr;
        }
@@ -811,9 +815,10 @@ public class Vala.Genie.Parser : CodeVisitor {
                List<DataType> type_arg_list = parse_type_argument_list (true);
                var expr = new MemberAccess.pointer (inner, id, get_src (begin));
                if (type_arg_list != null) {
-                       foreach (DataType type_arg in type_arg_list) {
+                       type_arg_list.foreach ((type_arg) => {
                                expr.add_type_argument (type_arg);
-                       }
+                               return true;
+                       });
                }
                return expr;
        }
@@ -874,9 +879,10 @@ public class Vala.Genie.Parser : CodeVisitor {
 
                var print_expr = new MethodCall (expr, get_src (begin));
                
-               foreach (Expression arg in arg_list) {
+               arg_list.foreach ((arg) => {
                        print_expr.add_argument (arg);
-               }
+                       return true;
+               });
                
                return print_expr;
                
@@ -898,9 +904,10 @@ public class Vala.Genie.Parser : CodeVisitor {
 
                var assert_expr = new MethodCall (expr, get_src (begin));
                
-               foreach (Expression arg in arg_list) {
+               arg_list.foreach ((arg) => {
                        assert_expr.add_argument (arg);
-               }
+                       return true;
+               });
                
                return assert_expr;
                
@@ -920,18 +927,21 @@ public class Vala.Genie.Parser : CodeVisitor {
 
                        var expr = new ObjectCreationExpression (member, get_src (begin));
                        expr.struct_creation = true;
-                       foreach (Expression arg in arg_list) {
+                       arg_list.foreach ((arg) => {
                                expr.add_argument (arg);
-                       }
-                       foreach (MemberInitializer initializer in init_list) {
+                               return true;
+                       });
+                       init_list.foreach ((initializer) => {
                                expr.add_member_initializer (initializer);
-                       }
+                               return true;
+                       });
                        return expr;
                } else {
                        var expr = new MethodCall (inner, get_src (begin));
-                       foreach (Expression arg in arg_list) {
+                       arg_list.foreach ((arg) => {
                                expr.add_argument (arg);
-                       }
+                               return true;
+                       });
                        return expr;
                }
        }
@@ -948,9 +958,10 @@ public class Vala.Genie.Parser : CodeVisitor {
 
                if (stop == null) {
                        var expr = new ElementAccess (inner, get_src (begin));
-                       foreach (Expression index in index_list) {
+                       index_list.foreach ((index) => {
                                expr.append_index (index);
-                       }
+                               return true;
+                       });
                        return expr;
                } else {
                        return new SliceExpression (inner, index_list[0], stop, get_src (begin));
@@ -1034,12 +1045,14 @@ public class Vala.Genie.Parser : CodeVisitor {
                var init_list = parse_object_initializer ();
 
                var expr = new ObjectCreationExpression (member, get_src (begin));
-               foreach (Expression arg in arg_list) {
+               arg_list.foreach ((arg) => {
                        expr.add_argument (arg);
-               }
-               foreach (MemberInitializer initializer in init_list) {
+                       return true;
+               });
+               init_list.foreach ((initializer) => {
                        expr.add_member_initializer (initializer);
-               }
+                       return true;
+               });
                return expr;
        }
 
@@ -1086,9 +1099,10 @@ public class Vala.Genie.Parser : CodeVisitor {
                
                var expr = new ArrayCreationExpression (etype, size_specifier_list.size, initializer, get_src 
(begin));
                if (size_specified) {
-                       foreach (Expression size in size_specifier_list) {
+                       size_specifier_list.foreach ((size) => {
                                expr.append_size (size);
-                       }
+                               return true;
+                       });
                }
                return expr;
        }
@@ -1585,9 +1599,10 @@ public class Vala.Genie.Parser : CodeVisitor {
                }
 
 
-               foreach (var param in params) {
+               params.foreach ((param) => {
                        lambda.add_parameter (param);
-               }
+                       return true;
+               });
                return lambda;
        }
 
@@ -2267,9 +2282,10 @@ public class Vala.Genie.Parser : CodeVisitor {
                        finally_clause = parse_finally_clause ();
                }
                var stmt = new TryStatement (try_block, finally_clause, get_src (begin));
-               foreach (CatchClause clause in catch_clauses) {
+               catch_clauses.foreach ((clause) => {
                        stmt.add_catch_clause (clause);
-               }
+                       return true;
+               });
                return stmt;
        }
 
@@ -2371,12 +2387,13 @@ public class Vala.Genie.Parser : CodeVisitor {
 
        void set_attributes (CodeNode node, List<Attribute>? attributes) {
                if (attributes != null) {
-                       foreach (Attribute attr in (List<Attribute>) attributes) {
+                       attributes.foreach ((attr) => {
                                if (node.get_attribute (attr.name) != null) {
                                        Report.error (attr.source_reference, "duplicate attribute 
`%s`".printf (attr.name));
                                }
                                node.attributes.append (attr);
-                       }
+                               return true;
+                       });
                }
        }
 
@@ -2657,12 +2674,14 @@ public class Vala.Genie.Parser : CodeVisitor {
                        cl.is_abstract = true;
                }
                set_attributes (cl, attrs);
-               foreach (TypeParameter type_param in type_param_list) {
+               type_param_list.foreach ((type_param) => {
                        cl.add_type_parameter (type_param);
-               }
-               foreach (DataType base_type in base_types) {
+                       return true;
+               });
+               base_types.foreach ((base_type) => {
                        cl.add_base_type (base_type);
-               }
+                       return true;
+               });
 
                class_name = cl.name;
 
@@ -2936,14 +2955,16 @@ public class Vala.Genie.Parser : CodeVisitor {
 
                set_attributes (method, attrs);
 
-               foreach (TypeParameter type_param in type_param_list) {
+               type_param_list.foreach ((type_param) => {
                        method.add_type_parameter (type_param);
-               }
+                       return true;
+               });
                
 
-               foreach (Parameter param in params) {
+               params.foreach ((param) => {
                        method.add_parameter (param);
-               }
+                       return true;
+               });
 
                if (accept (TokenType.RAISES)) {
                        do {
@@ -3239,9 +3260,10 @@ public class Vala.Genie.Parser : CodeVisitor {
 
                set_attributes (sig, attrs);
 
-               foreach (Parameter formal_param in params) {
+               params.foreach ((formal_param) => {
                        sig.add_parameter (formal_param);
-               }
+                       return true;
+               });
 
                if (!accept_terminator ()) {
                        sig.body = parse_block ();
@@ -3295,9 +3317,10 @@ public class Vala.Genie.Parser : CodeVisitor {
                        st.access = get_access (sym.name);
                }
                set_attributes (st, attrs);
-               foreach (TypeParameter type_param in type_param_list) {
+               type_param_list.foreach ((type_param) => {
                        st.add_type_parameter (type_param);
-               }
+                       return true;
+               });
                if (base_type != null) {
                        st.base_type = base_type;
                }
@@ -3360,12 +3383,14 @@ public class Vala.Genie.Parser : CodeVisitor {
                        iface.external = true;
                }
                set_attributes (iface, attrs);
-               foreach (TypeParameter type_param in type_param_list) {
+               type_param_list.foreach ((type_param) => {
                        iface.add_type_parameter (type_param);
-               }
-               foreach (DataType base_type in base_types) {
+                       return true;
+               });
+               base_types.foreach ((base_type) => {
                        iface.add_prerequisite (base_type);
-               }
+                       return true;
+               });
 
 
                expect (TokenType.EOL);
@@ -3758,13 +3783,15 @@ public class Vala.Genie.Parser : CodeVisitor {
 
                set_attributes (d, attrs);
 
-               foreach (TypeParameter type_param in type_param_list) {
+               type_param_list.foreach ((type_param) => {
                        d.add_type_parameter (type_param);
-               }
+                       return true;
+               });
 
-               foreach (Parameter formal_param in params) {
+               params.foreach ((formal_param) => {
                        d.add_parameter (formal_param);
-               }
+                       return true;
+               });
 
 
 
@@ -3863,9 +3890,10 @@ public class Vala.Genie.Parser : CodeVisitor {
                        List<DataType> type_arg_list = parse_type_argument_list (false);
                        expr = new MemberAccess (expr != null ? expr : base_expr, id, get_src (begin));
                        if (type_arg_list != null) {
-                               foreach (DataType type_arg in type_arg_list) {
+                               type_arg_list.foreach ((type_arg) => {
                                        expr.add_type_argument (type_arg);
-                               }
+                                       return true;
+                               });
                        }
                } while (accept (TokenType.DOT));
                return expr;
diff --git a/vala/valagirparser.vala b/vala/valagirparser.vala
index 5597f25..c6b1f03 100644
--- a/vala/valagirparser.vala
+++ b/vala/valagirparser.vala
@@ -114,11 +114,12 @@ public class Vala.GirParser : CodeVisitor {
                }
 
                public void add_sibling (Metadata metadata) {
-                       foreach (var child in metadata.children) {
+                       metadata.children.foreach ((child) => {
                                add_child (child);
-                       }
+                               return true;
+                       });
                        // merge arguments and take precedence
-                       foreach (var key in metadata.args.keys) {
+                       foreach (var key in metadata.args.keys) { // FIXME: Bug 
                                args[key] = metadata.args[key];
                        }
                }
@@ -155,7 +156,7 @@ public class Vala.GirParser : CodeVisitor {
 
                public Metadata match_child (string name, string? selector = null) {
                        var result = Metadata.empty;
-                       foreach (var metadata in children) {
+                       children.foreach ((metadata) => {
                                if ((selector == null || metadata.selector == null || metadata.selector == 
selector) && metadata.pattern_spec.match_string (name)) {
                                        metadata.used = true;
                                        if (result == Metadata.empty) {
@@ -172,7 +173,8 @@ public class Vala.GirParser : CodeVisitor {
                                                result = ms;
                                        }
                                }
-                       }
+                               return true;
+                       });
                        return result;
                }
 
@@ -820,11 +822,12 @@ public class Vala.GirParser : CodeVisitor {
 
                        if (symbol is Namespace && parent == parser.root) {
                                // first process aliases since they have no assigned symbol
-                               foreach (var node in members) {
+                               members.foreach ((node) => {
                                        if (node.element_type == "alias") {
                                                parser.process_alias (node);
                                        }
-                               }
+                                       return true;
+                               });
 
                                // auto reparent namespace methods, allowing node removals
                                for (int i=0; i < members.size; i++) {
@@ -862,9 +865,10 @@ public class Vala.GirParser : CodeVisitor {
                        }
 
                        // process children
-                       foreach (var node in members) {
+                       members.foreach ((node) => {
                                node.process (parser);
-                       }
+                               return true;
+                       });
 
                        if (girdata != null) {
                                // GIR node processing
@@ -873,7 +877,7 @@ public class Vala.GirParser : CodeVisitor {
                                        parser.process_callable (this);
 
                                        var colliding = parent.lookup_all (name);
-                                       foreach (var node in colliding) {
+                                       colliding.foreach ((node) => {
                                                var sym = node.symbol;
                                                if (sym is Field && !(m.return_type is VoidType) && 
m.get_parameters().size == 0) {
                                                        // assume method is getter
@@ -916,7 +920,8 @@ public class Vala.GirParser : CodeVisitor {
                                                                }
                                                        }
                                                }
-                                       }
+                                               return true;
+                                       });
                                        if (!(m is CreationMethod)) {
                                                if (metadata.has_argument (ArgumentType.DESTROYS_INSTANCE)) {
                                                        m.set_attribute ("DestroysInstance", 
metadata.get_bool (ArgumentType.DESTROYS_INSTANCE));
@@ -935,7 +940,7 @@ public class Vala.GirParser : CodeVisitor {
                                        }
                                } else if (symbol is Property) {
                                        var colliding = parent.lookup_all (name);
-                                       foreach (var node in colliding) {
+                                       colliding.foreach ((node) => {
                                                if (node.symbol is Signal) {
                                                        // properties take precedence
                                                        node.processed = true;
@@ -944,7 +949,8 @@ public class Vala.GirParser : CodeVisitor {
                                                        // getter in C, but not in Vala
                                                        node.merged = true;
                                                }
-                                       }
+                                               return true;
+                                       });
 
                                        var prop = (Property) symbol;
 
@@ -965,21 +971,23 @@ public class Vala.GirParser : CodeVisitor {
                                        Node getter = null;
                                        var getters = parent.lookup_all ("get_%s".printf (name));
                                        if (getters != null) {
-                                               foreach (var g in getters) {
+                                               getters.foreach ((g) => {
                                                        if ((getter == null || !g.merged) && g.get_cname () 
== "%sget_%s".printf (parent.get_lower_case_cprefix (), name)) {
                                                                getter = g;
                                                        }
-                                               }
+                                                       return true;
+                                               });
                                        }
 
                                        Node setter = null;
                                        var setters = parent.lookup_all ("set_%s".printf (name));
                                        if (setters != null) {
-                                               foreach (var s in setters) {
+                                               setters.foreach ((s) => {
                                                        if ((setter == null || !s.merged) && s.get_cname () 
== "%sset_%s".printf (parent.get_lower_case_cprefix (), name)) {
                                                                setter = s;
                                                        }
-                                               }
+                                                       return true;
+                                               });
                                        }
 
                                        prop.set_attribute ("NoAccessorMethod", false);
@@ -992,11 +1000,12 @@ public class Vala.GirParser : CodeVisitor {
                                                                prop.set_attribute ("NoAccessorMethod", true);
                                                        } else {
                                                                if (getter.name == name) {
-                                                                       foreach (var node in colliding) {
+                                                                       colliding.foreach ((node) => {
                                                                                if (node.symbol is Method) {
                                                                                        node.merged = true;
                                                                                }
-                                                                       }
+                                                                               return true;
+                                                                       });
                                                                }
                                                                
                                                                prop.get_accessor.value_type.value_owned = 
m.return_type.value_owned;
@@ -1117,7 +1126,7 @@ public class Vala.GirParser : CodeVisitor {
                                } else if (symbol is Struct) {
                                        if (parent.symbol is ObjectTypeSymbol || parent.symbol is Struct) {
                                                // nested struct
-                                               foreach (var fn in members) {
+                                               members.foreach ((fn) => {
                                                        var f = fn.symbol as Field;
                                                        if (f != null) {
                                                                if (f.binding == MemberBinding.INSTANCE) {
@@ -1127,7 +1136,8 @@ public class Vala.GirParser : CodeVisitor {
                                                                fn.name = f.name;
                                                                parent.add_member (fn);
                                                        }
-                                               }
+                                                       return true;
+                                               });
                                                merged = true;
                                        } else {
                                                // record for a gtype
@@ -1208,7 +1218,7 @@ public class Vala.GirParser : CodeVisitor {
                        }
 
                        if (!(new_symbol && merged) && is_container (symbol)) {
-                               foreach (var node in members) {
+                               members.foreach ((node) => {
                                        if (this.deprecated_version > 0 && node.deprecated_version > 0) {
                                                if (this.deprecated_version <= node.deprecated_version) {
                                                        node.deprecated = false;
@@ -1229,7 +1239,9 @@ public class Vala.GirParser : CodeVisitor {
                                        if (node.new_symbol && !node.merged && !metadata.get_bool 
(ArgumentType.HIDDEN)) {
                                                add_symbol_to_container (symbol, node.symbol);
                                        }
-                               }
+
+                                       return true;
+                               });
 
                                var cl = symbol as Class;
                                if (cl != null && !cl.is_compact && cl.default_construction_method == null) {
@@ -1307,30 +1319,32 @@ public class Vala.GirParser : CodeVisitor {
 
                root.process (this);
 
-               foreach (var metadata in metadata_roots) {
+               metadata_roots.foreach ((metadata) => {
                        report_unused_metadata (metadata);
-               }
+                       return true;
+               });
        }
 
        void map_vala_to_gir () {
-               foreach (var source_file in context.get_source_files ()) {
+               context.get_source_files ().foreach ((source_file) => {
                        string gir_namespace = source_file.gir_namespace;
                        string gir_version = source_file.gir_version;
                        Namespace ns = null;
                        if (gir_namespace == null) {
-                               foreach (var node in source_file.get_nodes ()) {
+                               source_file.get_nodes ().foreach ((node) => {
                                        if (node is Namespace) {
                                                ns = (Namespace) node;
                                                gir_namespace = ns.get_attribute_string ("CCode", 
"gir_namespace");
                                                if (gir_namespace != null) {
                                                        gir_version = ns.get_attribute_string ("CCode", 
"gir_version");
-                                                       break;
+                                                       return false;
                                                }
                                        }
-                               }
+                                       return true;
+                               });
                        }
                        if (gir_namespace == null) {
-                               continue;
+                               return true;
                        }
 
                        provided_namespaces.add ("%s-%s".printf (gir_namespace, gir_version));
@@ -1340,13 +1354,15 @@ public class Vala.GirParser : CodeVisitor {
                                set_symbol_mapping (gir_symbol, ns);
                        }
 
-                       foreach (var node in source_file.get_nodes ()) {
+                       source_file.get_nodes ().foreach ((node) => {
                                if (node.has_attribute_argument ("GIR", "name")) {
                                        var map_from = new UnresolvedSymbol (gir_symbol, 
node.get_attribute_string ("GIR", "name"));
                                        set_symbol_mapping (map_from, (Symbol) node);
                                }
-                       }
-               }
+                               return true;
+                       });
+                       return true;
+               });
        }
 
        public override void visit_source_file (SourceFile source_file) {
@@ -1524,20 +1540,21 @@ public class Vala.GirParser : CodeVisitor {
        void assume_parameter_names (Signal sig, Symbol sym, bool skip_first) {
                var iter = ((Callable) sym).get_parameters ().iterator ();
                bool first = true;
-               foreach (var param in sig.get_parameters ()) {
+               sig.get_parameters ().foreach ((param) => {
                        if (!iter.next ()) {
                                // unreachable for valid GIR
-                               break;
+                               return false;
                        }
                        if (skip_first && first) {
                                if (!iter.next ()) {
                                        // unreachable for valid GIR
-                                       break;
+                                       return false;
                                }
                                first = false;
                        }
                        param.name = iter.get ().name;
-               }
+                       return true;
+               });
        }
 
        Node? find_invoker (Node node) {
@@ -1554,13 +1571,14 @@ public class Vala.GirParser : CodeVisitor {
                                continue;
                        }
                        var iter = invoker.get_parameters ().iterator ();
-                       foreach (var param in m.get_parameters ()) {
+                       m.get_parameters ().foreach ((param) => {
                                assert (iter.next ());
                                if (param.name != iter.get().name)      {
                                        invoker = null;
-                                       break;
+                                       return false;
                                }
-                       }
+                               return true;
+                       });
                        if (invoker != null) {
                                return n;
                        }
@@ -3435,20 +3453,21 @@ public class Vala.GirParser : CodeVisitor {
                        }
                }
 
-               foreach (var child in metadata.children) {
+               metadata.children.foreach ((child) => {
                        if (!child.used) {
                                Report.warning (child.source_reference, "metadata never used");
                        } else {
                                report_unused_metadata (child);
                        }
-               }
+                       return true;
+               });
        }
 
        /* Post-parsing */
 
        void resolve_gir_symbols () {
                // gir has simple namespaces, we won't get deeper than 2 levels here, except reparenting
-               foreach (var map_from in unresolved_gir_symbols) {
+               unresolved_gir_symbols.foreach ((map_from) => {
                        while (map_from != null) {
                                var map_to = unresolved_symbols_map[map_from];
                                if (map_to != null) {
@@ -3473,7 +3492,8 @@ public class Vala.GirParser : CodeVisitor {
                                }
                                map_from = map_from.inner;
                        }
-               }
+                       return true;
+               });
        }
 
        void create_new_namespaces () {
@@ -3486,7 +3506,7 @@ public class Vala.GirParser : CodeVisitor {
 
        void resolve_type_arguments () {
                // box structs in type arguments
-               foreach (var element_type in unresolved_type_arguments) {
+               unresolved_type_arguments.foreach ((element_type) => {
                        TypeSymbol sym = null;
                        if (element_type is UnresolvedType) {
                                sym = (TypeSymbol) resolve_symbol (root, ((UnresolvedType) 
element_type).unresolved_symbol);
@@ -3497,7 +3517,8 @@ public class Vala.GirParser : CodeVisitor {
                        if (st != null && !st.is_integer_type () && !st.is_floating_type ()) {
                                element_type.nullable = true;
                        }
-               }
+                       return true;
+               });
        }
 
        void process_interface (Node iface_node) {
@@ -3505,7 +3526,7 @@ public class Vala.GirParser : CodeVisitor {
                   ensure we have at least one instantiable prerequisite */
                Interface iface = (Interface) iface_node.symbol;
                bool has_instantiable_prereq = false;
-               foreach (DataType prereq in iface.get_prerequisites ()) {
+               iface.get_prerequisites ().foreach ((prereq) => {
                        Symbol sym = null;
                        if (prereq is UnresolvedType) {
                                var unresolved_symbol = ((UnresolvedType) prereq).unresolved_symbol;
@@ -3515,9 +3536,10 @@ public class Vala.GirParser : CodeVisitor {
                        }
                        if (sym is Class) {
                                has_instantiable_prereq = true;
-                               break;
+                               return false;
                        }
-               }
+                       return true;
+               });
 
                if (!has_instantiable_prereq) {
                        iface.add_prerequisite (new ObjectType ((ObjectTypeSymbol) glib_ns.scope.lookup 
("Object")));
@@ -3634,11 +3656,12 @@ public class Vala.GirParser : CodeVisitor {
                        }
                } else if (return_type is VoidType && parameters.size > 0) {
                        int n_out_parameters = 0;
-                       foreach (var info in parameters) {
+                       parameters.foreach ((info) => {
                                if (info.param.direction == ParameterDirection.OUT) {
                                        n_out_parameters++;
                                }
-                       }
+                               return true;
+                       });
 
                        if (n_out_parameters == 1) {
                                ParameterInfo last_param = parameters[parameters.size-1];
@@ -3694,7 +3717,7 @@ public class Vala.GirParser : CodeVisitor {
                int i = 0, j=1;
 
                int last = -1;
-               foreach (ParameterInfo info in parameters) {
+               parameters.foreach ((info) => {
                        if (s is Delegate && info.closure_idx == i) {
                                var d = (Delegate) s;
                                d.has_target = true;
@@ -3725,11 +3748,12 @@ public class Vala.GirParser : CodeVisitor {
                                info.vala_idx = (j - 1) + (i - last) * 0.1F;
                        }
                        i++;
-               }
+                       return true;
+               });
 
-               foreach (ParameterInfo info in parameters) {
+               parameters.foreach ((info) => {
                        if (!info.keep) {
-                               continue;
+                               return true;
                        }
 
                        /* add_parameter sets carray_length_parameter_position and 
cdelegate_target_parameter_position
@@ -3741,7 +3765,7 @@ public class Vala.GirParser : CodeVisitor {
                        if (info.array_length_idx != -1) {
                                if ((info.array_length_idx) >= parameters.size) {
                                        Report.error (info.param.source_reference, "invalid array_length 
index");
-                                       continue;
+                                       return true;
                                }
                                set_array_ccode (info.param, parameters[info.array_length_idx]);
                        }
@@ -3749,7 +3773,7 @@ public class Vala.GirParser : CodeVisitor {
                        if (info.closure_idx != -1) {
                                if ((info.closure_idx) >= parameters.size) {
                                        Report.error (info.param.source_reference, "invalid closure index");
-                                       continue;
+                                       return true;
                                }
                                if ("%g".printf (parameters[info.closure_idx].vala_idx) != "%g".printf 
(info.vala_idx + 0.1)) {
                                        info.param.set_attribute_double ("CCode", "delegate_target_pos", 
parameters[info.closure_idx].vala_idx);
@@ -3758,7 +3782,7 @@ public class Vala.GirParser : CodeVisitor {
                        if (info.destroy_idx != -1) {
                                if (info.destroy_idx >= parameters.size) {
                                        Report.error (info.param.source_reference, "invalid destroy index");
-                                       continue;
+                                       return true;
                                }
                                if ("%g".printf (parameters[info.destroy_idx].vala_idx) != "%g".printf 
(info.vala_idx + 0.2)) {
                                        info.param.set_attribute_double ("CCode", "destroy_notify_pos", 
parameters[info.destroy_idx].vala_idx);
@@ -3787,7 +3811,8 @@ public class Vala.GirParser : CodeVisitor {
                                        info.param.variable_type.value_owned = (info.closure_idx != -1 && 
info.destroy_idx != -1);
                                }
                        }
-               }
+                       return true;;
+               });
 
                if (return_type is ArrayType && node.return_array_length_idx >= 0) {
                        set_array_ccode (s, parameters[node.return_array_length_idx]);
@@ -3878,14 +3903,15 @@ public class Vala.GirParser : CodeVisitor {
                if (nodes == null) {
                        return;
                }
-               foreach (var n in nodes) {
+               nodes.foreach ((n) => {
                        if (node != n) {
                                n.process (this);
                        }
-               }
-               foreach (var n in nodes) {
+                       return true;
+               });
+               nodes.foreach ((n) => {
                        if (n.merged) {
-                               continue;
+                               return true;
                        }
                        var sym = n.symbol;
                        if (sym is Signal) {
@@ -3896,7 +3922,8 @@ public class Vala.GirParser : CodeVisitor {
                                var prop = (Property) sym;
                                prop.is_virtual = true;
                        }
-               }
+                       return true;
+               });
        }
 
        void process_async_method (Node node) {
@@ -3915,12 +3942,13 @@ public class Vala.GirParser : CodeVisitor {
                // check if the method is using non-standard finish method name
                if (finish_method_node == null) {
                        var method_cname = node.get_finish_cname ();
-                       foreach (var n in node.parent.members) {
+                       node.parent.members.foreach ((n) => {
                                if (n.symbol is Method && n.get_cname () == method_cname) {
                                        finish_method_node = n;
-                                       break;
+                                       return false;
                                }
-                       }
+                               return true;
+                       });
                }
 
                Method method = m;
@@ -3948,9 +3976,10 @@ public class Vala.GirParser : CodeVisitor {
                                } else if (finish_method_base.has_prefix ("new_")) {
                                        method.name = m.name.substring ("new_".length);
                                }
-                               foreach (var param in m.get_parameters ()) {
+                               m.get_parameters ().foreach ((param) => {
                                        method.add_parameter (param);
-                               }
+                                       return true;
+                               });
                                node.symbol = method;
                        } else {
                                method.return_type = finish_method.return_type.copy ();
@@ -3963,7 +3992,7 @@ public class Vala.GirParser : CodeVisitor {
                                }
                        }
 
-                       foreach (var param in finish_method.get_parameters ()) {
+                       finish_method.get_parameters ().foreach ((param) => {
                                if (param.direction == ParameterDirection.OUT) {
                                        var async_param = param.copy ();
                                        if (method.scope.lookup (param.name) != null) {
@@ -3972,11 +4001,13 @@ public class Vala.GirParser : CodeVisitor {
                                        }
                                        method.add_parameter (async_param);
                                }
-                       }
+                               return true;
+                       });
 
-                       foreach (DataType error_type in finish_method.get_error_types ()) {
+                       finish_method.get_error_types ().foreach ((error_type) => {
                                method.add_error_type (error_type.copy ());
-                       }
+                               return true;
+                       });
                        finish_method_node.processed = true;
                        finish_method_node.merged = true;
                }
diff --git a/vala/valainitializerlist.vala b/vala/valainitializerlist.vala
index c1f97ca..3d7d9cb 100644
--- a/vala/valainitializerlist.vala
+++ b/vala/valainitializerlist.vala
@@ -67,9 +67,10 @@ public class Vala.InitializerList : Expression {
        }
 
        public override void accept_children (CodeVisitor visitor) {
-               foreach (Expression expr in initializers) {
+               initializers.foreach ((expr) => {
                        expr.accept (visitor);
-               }
+                       return true;
+               });
        }
 
        public override void accept (CodeVisitor visitor) {
@@ -79,21 +80,15 @@ public class Vala.InitializerList : Expression {
        }
 
        public override bool is_constant () {
-               foreach (Expression initializer in initializers) {
-                       if (!initializer.is_constant ()) {
-                               return false;
-                       }
-               }
-               return true;
+               return initializers.foreach ((initializer) => {
+                       return initializer.is_constant ();
+               });
        }
 
        public override bool is_pure () {
-               foreach (Expression initializer in initializers) {
-                       if (!initializer.is_pure ()) {
-                               return false;
-                       }
-               }
-               return true;
+               return initializers.foreach ((initializer) => {
+                       return initializer.is_pure ();
+               });
        }
 
        public override bool is_accessible (Symbol sym) {
@@ -157,9 +152,10 @@ public class Vala.InitializerList : Expression {
                                inner_target_type = array_type.element_type.copy ();
                        }
 
-                       foreach (Expression e in get_initializers ()) {
+                       get_initializers ().foreach ((e) => {
                                e.target_type = inner_target_type;
-                       }
+                               return true;
+                       });
                } else if (target_type.data_type is Struct) {
                        /* initializer is used as struct initializer */
                        var st = (Struct) target_type.data_type;
@@ -194,16 +190,17 @@ public class Vala.InitializerList : Expression {
                        return false;
                }
 
-               foreach (Expression expr in initializers) {
+               initializers.foreach ((expr) => {
                        expr.check (context);
-               }
+                       return true;
+               });
 
                bool error = false;
-               foreach (Expression e in get_initializers ()) {
+               get_initializers ().foreach ((e) => {
                        if (e.value_type == null) {
                                error = true;
                                Report.error (e.source_reference, "expression type not allowed as 
initializer");
-                               continue;
+                               return false;
                        }
 
                        var unary = e as UnaryExpression;
@@ -214,7 +211,8 @@ public class Vala.InitializerList : Expression {
                                e.error = true;
                                Report.error (e.source_reference, "Expected initializer of type `%s' but got 
`%s'".printf (e.target_type.to_string (), e.value_type.to_string ()));
                        }
-               }
+                       return true;
+               });
 
                if (!error) {
                        /* everything seems to be correct */
@@ -226,9 +224,10 @@ public class Vala.InitializerList : Expression {
        }
 
        public override void emit (CodeGenerator codegen) {
-               foreach (Expression expr in initializers) {
+               initializers.foreach ((expr) => {
                        expr.emit (codegen);
-               }
+                       return true;
+               });
 
                codegen.visit_initializer_list (this);
 
diff --git a/vala/valainterface.vala b/vala/valainterface.vala
index 621c6e8..c93b273 100644
--- a/vala/valainterface.vala
+++ b/vala/valainterface.vala
@@ -288,50 +288,61 @@ public class Vala.Interface : ObjectTypeSymbol {
        }
 
        public override void accept_children (CodeVisitor visitor) {
-               foreach (DataType type in prerequisites) {
+               prerequisites.foreach ((type) => {
                        type.accept (visitor);
-               }
+                       return true;
+               });
 
-               foreach (TypeParameter p in get_type_parameters ()) {
+               get_type_parameters ().foreach ((p) => {
                        p.accept (visitor);
-               }
+                       return true;
+               });
 
                /* process enums first to avoid order problems in C code */
-               foreach (Enum en in enums) {
+               enums.foreach ((en) => {
                        en.accept (visitor);
-               }
+                       return true;
+               });
 
-               foreach (Method m in methods) {
+           methods.foreach ((m) => {
                        m.accept (visitor);
-               }
+                       return true;
+               });
                
-               foreach (Field f in fields) {
+               fields.foreach ((f) => {
                        f.accept (visitor);
-               }
+                       return true;
+               });
 
-               foreach (Constant c in constants) {
+               constants.foreach ((c) => {
                        c.accept (visitor);
-               }
+                       return true;
+               });
 
-               foreach (Property prop in properties) {
+               properties.foreach ((prop) => {
                        prop.accept (visitor);
-               }
+                       return true;
+               });
                
-               foreach (Signal sig in signals) {
+               signals.foreach ((sig) => {
                        sig.accept (visitor);
-               }
+                       return true;
+               });
                
-               foreach (Class cl in classes) {
+               classes.foreach ((cl) => {
                        cl.accept (visitor);
-               }
+                       return true;
+               });
                
-               foreach (Struct st in structs) {
+               structs.foreach ((st) => {
                        st.accept (visitor);
-               }
+                       return true;
+               });
 
-               foreach (Delegate d in delegates) {
+               delegates.foreach ((d) => {
                        d.accept (visitor);
-               }
+                       return true;
+               });
        }
 
        public override bool is_reference_type () {
@@ -343,13 +354,9 @@ public class Vala.Interface : ObjectTypeSymbol {
                        return true;
                }
 
-               foreach (DataType prerequisite in prerequisites) {
-                       if (prerequisite.data_type != null && prerequisite.data_type.is_subtype_of (t)) {
-                               return true;
-                       }
-               }
-               
-               return false;
+               return !prerequisites.foreach ((prerequisite) => {
+                       return !(prerequisite.data_type != null && prerequisite.data_type.is_subtype_of (t));
+               });
        }
        
        public override void replace_type (DataType old_type, DataType new_type) {
@@ -414,63 +421,74 @@ public class Vala.Interface : ObjectTypeSymbol {
                        }
                }
 
-               foreach (DataType type in prerequisites) {
+               prerequisites.foreach ((type) => {
                        type.check (context);
-               }
+                       return true;
+               });
 
-               foreach (TypeParameter p in get_type_parameters ()) {
+               get_type_parameters ().foreach ((p) => {
                        p.check (context);
-               }
+                       return true;
+               });
 
-               foreach (Enum en in enums) {
+               enums.foreach ((en) => {
                        en.check (context);
-               }
+                       return true;
+               });
 
-               foreach (Method m in methods) {
+               methods.foreach ((m) => {
                        m.check (context);
                        if (m.is_virtual || m.is_abstract) {
                                virtuals.add (m);
                        }
-               }
+                       return true;
+               });
 
-               foreach (Field f in fields) {
+               fields.foreach ((f) => {
                        f.check (context);
-               }
+                       return true;
+               });
 
-               foreach (Constant c in constants) {
+               constants.foreach ((c) => {
                        c.check (context);
-               }
+                       return true;
+               });
 
-               foreach (Signal sig in signals) {
+               signals.foreach ((sig) => {
                        sig.check (context);
                        if (sig.is_virtual) {
                                virtuals.add (sig);
                        }
-               }
+                       return true;
+               });
 
-               foreach (Property prop in properties) {
+               properties.foreach ((prop) => {
                        prop.check (context);
                        if (prop.is_virtual || prop.is_abstract) {
                                virtuals.add (prop);
                        }
-               }
-
-               foreach (Class cl in classes) {
+                       return true;
+               });
+               
+               classes.foreach ((cl) => {
                        cl.check (context);
-               }
+                       return true;
+               });
 
-               foreach (Struct st in structs) {
+               structs.foreach ((st) => {
                        st.check (context);
-               }
+                       return true;
+               });
 
-               foreach (Delegate d in delegates) {
+               delegates.foreach ((d) => {
                        d.check (context);
-               }
+                       return true;
+               });
 
                Map<int, Symbol>? positions = new HashMap<int, Symbol> ();
                bool ordered_seen = false;
                bool unordered_seen = false;
-               foreach (Symbol sym in virtuals) {
+               virtuals.foreach ((sym) => {
                        int ordering = sym.get_attribute_integer ("CCode", "ordering", -1);
                        if (ordering < -1) {
                                Report.error (sym.source_reference, "%s: Invalid ordering".printf 
(sym.get_full_name ()));
@@ -478,7 +496,7 @@ public class Vala.Interface : ObjectTypeSymbol {
                                error = true;
                                ordered_seen = true;
                                unordered_seen = true;
-                               continue;
+                               return true;
                        }
                        bool ordered = ordering != -1;
                        if (ordered && unordered_seen && !ordered_seen) {
@@ -501,7 +519,8 @@ public class Vala.Interface : ObjectTypeSymbol {
                                        positions[ordering] = sym;
                                }
                        }
-               }
+                       return true;
+               });
                if (ordered_seen) {
                        for (int i = 0; i < virtuals.size; i++) {
                                Symbol? sym = positions[i];
diff --git a/vala/valainterfacetype.vala b/vala/valainterfacetype.vala
index 3ca1a2c..94fe02d 100644
--- a/vala/valainterfacetype.vala
+++ b/vala/valainterfacetype.vala
@@ -43,9 +43,10 @@ public class Vala.InterfaceType : ReferenceType {
                result.is_dynamic = is_dynamic;
                result.floating_reference = floating_reference;
                
-               foreach (DataType arg in get_type_arguments ()) {
+               get_type_arguments ().foreach ((arg) => {
                        result.add_type_argument (arg.copy ());
-               }
+                       return true;
+               });
                
                return result;
        }
diff --git a/vala/valalambdaexpression.vala b/vala/valalambdaexpression.vala
index 1d6f957..132f8b1 100644
--- a/vala/valalambdaexpression.vala
+++ b/vala/valalambdaexpression.vala
@@ -175,10 +175,10 @@ public class Vala.LambdaExpression : Expression {
                        method.add_parameter (lambda_param);
                }
 
-               foreach (Parameter cb_param in cb.get_parameters ()) {
+               cb.get_parameters ().foreach ((cb_param) => {
                        if (!lambda_param_it.next ()) {
                                /* lambda expressions are allowed to have less parameters */
-                               break;
+                               return false;
                        }
 
                        Parameter lambda_param = lambda_param_it.get ();
@@ -190,7 +190,8 @@ public class Vala.LambdaExpression : Expression {
 
                        lambda_param.variable_type = cb_param.variable_type.get_actual_type (target_type, 
null, this);
                        method.add_parameter (lambda_param);
-               }
+                       return true;
+               });
 
                if (lambda_param_it.next ()) {
                        /* lambda expressions may not expect more parameters */
@@ -199,9 +200,10 @@ public class Vala.LambdaExpression : Expression {
                        return false;
                }
 
-               foreach (var error_type in cb.get_error_types ()) {
+               cb.get_error_types ().foreach ((error_type) => {
                        method.add_error_type (error_type.copy ());
-               }
+                       return true;
+               });
 
                if (expression_body != null) {
                        var block = new Block (source_reference);
@@ -222,12 +224,13 @@ public class Vala.LambdaExpression : Expression {
                // support use of generics in closures
                var m = context.analyzer.find_parent_method (context.analyzer.current_symbol);
                if (m != null) {
-                       foreach (var type_param in m.get_type_parameters ()) {
+                       m.get_type_parameters ().foreach ((type_param) => {
                                method.add_type_parameter (new TypeParameter (type_param.name, 
type_param.source_reference));
 
                                method.closure = true;
                                m.body.captured = true;
-                       }
+                               return true;
+                       });
                }
 
                /* lambda expressions should be usable like MemberAccess of a method */
diff --git a/vala/valamarkupreader.vala b/vala/valamarkupreader.vala
index 60423f2..c831e44 100644
--- a/vala/valamarkupreader.vala
+++ b/vala/valamarkupreader.vala
@@ -72,9 +72,7 @@ public class Vala.MarkupReader : Object {
         */
        public Map<string,string> get_attributes () {
                var result = new HashMap<string,string> ();
-               foreach (var key in attributes.keys) {
-                       result.set (key, attributes.get (key));
-               }
+               result.set_all (attributes);
                return result;
        }
 
diff --git a/vala/valamemberaccess.vala b/vala/valamemberaccess.vala
index 6911bef..569f7d9 100644
--- a/vala/valamemberaccess.vala
+++ b/vala/valamemberaccess.vala
@@ -126,9 +126,10 @@ public class Vala.MemberAccess : Expression {
                        inner.accept (visitor);
                }
                
-               foreach (DataType type_arg in type_argument_list) {
+               type_argument_list.foreach ((type_arg) => {
                        type_arg.accept (visitor);
-               }
+                       return true;
+           });
        }
 
        public override string to_string () {
@@ -204,9 +205,10 @@ public class Vala.MemberAccess : Expression {
                        inner.check (context);
                }
                
-               foreach (DataType type_arg in type_argument_list) {
+               type_argument_list.foreach ((type_arg) => {
                        type_arg.check (context);
-               }
+                       return true;
+               });
 
                Symbol base_symbol = null;
                Parameter this_parameter = null;
@@ -631,13 +633,14 @@ public class Vala.MemberAccess : Expression {
 
                        // do not allow access to methods using generic type parameters
                        // if instance type does not specify type arguments
-                       foreach (var param in m.get_parameters ()) {
+                       m.get_parameters ().foreach ((param) => {
                                var generic_type = param.variable_type as GenericType;
                                if (generic_type != null && generic_type.type_parameter.parent_symbol is 
TypeSymbol) {
                                        generics = true;
-                                       break;
+                                       return false;
                                }
-                       }
+                               return true;
+                       });
                        var generic_type = m.return_type as GenericType;
                        if (generic_type != null && generic_type.type_parameter.parent_symbol is TypeSymbol) {
                                generics = true;
@@ -810,9 +813,10 @@ public class Vala.MemberAccess : Expression {
                                // support static methods in generic classes
                                inner.value_type = new ObjectType ((ObjectTypeSymbol) m.parent_symbol);
 
-                               foreach (var type_argument in inner_ma.type_argument_list) {
+                               inner_ma.type_argument_list.foreach ((type_argument) => {
                                        inner.value_type.add_type_argument (type_argument);
-                               }
+                                       return true;
+                               });
                        }
 
                        formal_value_type = context.analyzer.get_value_type_for_symbol (symbol_reference, 
lvalue);
diff --git a/vala/valamethod.vala b/vala/valamethod.vala
index f79ec7b..e6d4a5a 100644
--- a/vala/valamethod.vala
+++ b/vala/valamethod.vala
@@ -235,21 +235,19 @@ public class Vala.Method : Subroutine, Callable {
         * Remove all parameters from this method.
         */
        public void clear_parameters () {
-               foreach (Parameter param in parameters) {
+               parameters.foreach ((param) => {
                        if (!param.ellipsis) {
                                scope.remove (param.name);
                        }
-               }
+                       return true;
+               });
                parameters.clear ();
        }
 
        public bool is_variadic () {
-               foreach (Parameter param in parameters) {
-                       if (param.ellipsis) {
-                               return true;
-                       }
-               }
-               return false;
+               return !parameters.foreach ((param) => {
+                       return !param.ellipsis;
+               });
        }
 
        public override void accept (CodeVisitor visitor) {
@@ -257,9 +255,10 @@ public class Vala.Method : Subroutine, Callable {
        }
 
        public override void accept_children (CodeVisitor visitor) {
-               foreach (TypeParameter p in get_type_parameters ()) {
+               get_type_parameters ().foreach ((p) => {
                        p.accept (visitor);
-               }
+                       return true;
+               });
 
                if (base_interface_type != null) {
                        base_interface_type.accept (visitor);
@@ -269,28 +268,32 @@ public class Vala.Method : Subroutine, Callable {
                        return_type.accept (visitor);
                }
 
-               foreach (Parameter param in parameters) {
+               parameters.foreach ((param) => {
                        param.accept (visitor);
-               }
+                       return true;
+               });
 
-               foreach (DataType error_type in get_error_types ()) {
+               get_error_types ().foreach ((error_type) => {
                        error_type.accept (visitor);
-               }
+                       return true;
+               });
 
                if (result_var != null) {
                        result_var.accept (visitor);
                }
 
                if (preconditions != null) {
-                       foreach (Expression precondition in preconditions) {
+                       preconditions.foreach ((precondition) => {
                                precondition.accept (visitor);
-                       }
+                               return true;
+                       });
                }
 
                if (postconditions != null) {
-                       foreach (Expression postcondition in postconditions) {
+                       postconditions.foreach ((postcondition) => {
                                postcondition.accept (visitor);
-                       }
+                               return true;
+                       });
                }
 
                if (body != null) {
@@ -315,11 +318,12 @@ public class Vala.Method : Subroutine, Callable {
                ObjectType object_type = null;
                if (parent_symbol is ObjectTypeSymbol) {
                        object_type = new ObjectType ((ObjectTypeSymbol) parent_symbol);
-                       foreach (TypeParameter type_parameter in object_type.type_symbol.get_type_parameters 
()) {
+                       object_type.type_symbol.get_type_parameters ().foreach ((type_parameter) => {
                                var type_arg = new GenericType (type_parameter);
                                type_arg.value_owned = true;
                                object_type.add_type_argument (type_arg);
-                       }
+                               return true;
+                       });
                }
 
                if (this.get_type_parameters ().size < base_method.get_type_parameters ().size) {
@@ -383,13 +387,12 @@ public class Vala.Method : Subroutine, Callable {
 
                /* this method may throw less but not more errors than the base method */
                foreach (DataType method_error_type in get_error_types ()) {
-                       bool match = false;
-                       foreach (DataType base_method_error_type in base_method.get_error_types ()) {
+                       bool match = !base_method.get_error_types ().foreach ((base_method_error_type) => {
                                if (method_error_type.compatible (base_method_error_type)) {
-                                       match = true;
-                                       break;
+                                       return false;
                                }
-                       }
+                               return true;
+                       });
 
                        if (!match) {
                                invalid_match = "incompatible error type `%s'".printf 
(method_error_type.to_string ());
@@ -746,15 +749,17 @@ public class Vala.Method : Subroutine, Callable {
                }
 
                if (preconditions != null) {
-                       foreach (Expression precondition in preconditions) {
+                       preconditions.foreach ((precondition) => {
                                precondition.check (context);
-                       }
+                               return true;
+                       });
                }
 
                if (postconditions != null) {
-                       foreach (Expression postcondition in postconditions) {
+                       postconditions.foreach ((postcondition) => {
                                postcondition.check (context);
-                       }
+                               return true;
+                       });
                }
 
                if (body != null) {
@@ -833,18 +838,20 @@ public class Vala.Method : Subroutine, Callable {
 
                // check that all errors that can be thrown in the method body are declared
                if (body != null) { 
-                       foreach (DataType body_error_type in body.get_error_types ()) {
+                       body.get_error_types ().foreach ((body_error_type) => {
                                bool can_propagate_error = false;
-                               foreach (DataType method_error_type in get_error_types ()) {
+                               get_error_types ().foreach ((method_error_type) => {
                                        if (body_error_type.compatible (method_error_type)) {
                                                can_propagate_error = true;
                                        }
-                               }
+                                       return true;
+                               });
                                bool is_dynamic_error = body_error_type is ErrorType && ((ErrorType) 
body_error_type).dynamic_error;
                                if (!can_propagate_error && !is_dynamic_error) {
                                        Report.warning (body_error_type.source_reference, "unhandled error 
`%s'".printf (body_error_type.to_string()));
                                }
-                       }
+                               return true;
+                       });
                }
 
                if (is_possible_entry_point (context)) {
@@ -941,13 +948,14 @@ public class Vala.Method : Subroutine, Callable {
 
        public int get_required_arguments () {
                int n = 0;
-               foreach (var param in parameters) {
+               parameters.foreach ((param) => {
                        if (param.initializer != null || param.ellipsis) {
                                // optional argument
-                               break;
+                               return false;
                        }
                        n++;
-               }
+                       return true;
+               });
                return n;
        }
 
@@ -974,13 +982,14 @@ public class Vala.Method : Subroutine, Callable {
 
                var params = new ArrayList<Parameter> ();
                Parameter ellipsis = null;
-               foreach (var param in parameters) {
+               parameters.foreach ((param) => {
                        if (param.ellipsis) {
                                ellipsis = param;
                        } else if (param.direction == ParameterDirection.IN) {
                                params.add (param);
                        }
-               }
+                       return true;
+               });
 
                var callback_type = new DelegateType ((Delegate) glib_ns.scope.lookup ("AsyncReadyCallback"));
                callback_type.nullable = true;
@@ -1014,11 +1023,12 @@ public class Vala.Method : Subroutine, Callable {
                result_param.set_attribute_double ("CCode", "pos", 0.1);
                params.add (result_param);
 
-               foreach (var param in parameters) {
+               parameters.foreach ((param) => {
                        if (param.direction == ParameterDirection.OUT) {
                                params.add (param);
                        }
-               }
+                       return true;
+               });
 
                return params;
        }
@@ -1034,9 +1044,10 @@ public class Vala.Method : Subroutine, Callable {
 
        public void get_captured_variables (Collection<LocalVariable> variables) {
                if (captured_variables != null) {
-                       foreach (var local in captured_variables) {
+                       captured_variables.foreach ((local) => {
                                variables.add (local);
-                       }
+                               return true;
+                       });
                }
        }
 
diff --git a/vala/valamethodcall.vala b/vala/valamethodcall.vala
index 7bf0e49..651b6e4 100644
--- a/vala/valamethodcall.vala
+++ b/vala/valamethodcall.vala
@@ -90,9 +90,10 @@ public class Vala.MethodCall : Expression {
        public override void accept_children (CodeVisitor visitor) {
                call.accept (visitor);
 
-               foreach (Expression expr in argument_list) {
+               argument_list.foreach ((expr) => {
                        expr.accept (visitor);
-               }
+                       return true;
+               });
        }
 
        public override void replace_expression (Expression old_node, Expression new_node) {
@@ -299,9 +300,10 @@ public class Vala.MethodCall : Expression {
                        }
                        var struct_creation_expression = new ObjectCreationExpression ((MemberAccess) call, 
source_reference);
                        struct_creation_expression.struct_creation = true;
-                       foreach (Expression arg in get_argument_list ()) {
+                       get_argument_list ().foreach ((arg) => {
                                struct_creation_expression.add_argument (arg);
-                       }
+                               return true;
+                       });
                        struct_creation_expression.target_type = target_type;
                        context.analyzer.replaced_nodes.add (this);
                        parent_node.replace_expression (this, struct_creation_expression);
@@ -390,9 +392,9 @@ public class Vala.MethodCall : Expression {
 
                var args = get_argument_list ();
                Iterator<Expression> arg_it = args.iterator ();
-               foreach (Parameter param in params) {
+               params.foreach ((param) => {
                        if (param.ellipsis) {
-                               break;
+                               return false;
                        }
 
                        if (param.params_array) {
@@ -404,7 +406,7 @@ public class Vala.MethodCall : Expression {
                                        arg.target_type = array_type.element_type;
                                        arg.target_type.value_owned = array_type.value_owned;
                                }
-                               break;
+                               return false;
                        }
 
                        if (arg_it.next ()) {
@@ -416,15 +418,17 @@ public class Vala.MethodCall : Expression {
 
                                last_arg = arg;
                        }
-               }
+                       return true;
+               });
 
                // concatenate stringified arguments for methods with attribute [Print]
                if (mtype is MethodType && ((MethodType) mtype).method_symbol.get_attribute ("Print") != 
null) {
                        var template = new Template (source_reference);
-                       foreach (Expression arg in argument_list) {
+                       argument_list.foreach ((arg) => {
                                arg.parent_node = null;
                                template.add_expression (arg);
-                       }
+                               return true;
+                       });
                        argument_list.clear ();
                        add_argument (template);
                }
@@ -443,12 +447,13 @@ public class Vala.MethodCall : Expression {
 
                                        // recreate iterator and skip to right position
                                        arg_it = argument_list.iterator ();
-                                       foreach (Parameter param in params) {
+                                       params.foreach ((param) => {
                                                if (param.ellipsis) {
-                                                       break;
+                                                       return false;
                                                }
                                                arg_it.next ();
-                                       }
+                                               return true;
+                                       });
                                }
                        } else {
                                // use instance as format string for string.printf (...)
@@ -465,9 +470,10 @@ public class Vala.MethodCall : Expression {
                        }
                }
 
-               foreach (Expression arg in get_argument_list ()) {
+               get_argument_list ().foreach ((arg) => {
                        arg.check (context);
-               }
+                       return true;
+               });
 
                if (ret_type is VoidType) {
                        // void return type
@@ -503,7 +509,7 @@ public class Vala.MethodCall : Expression {
                        if (m != null && m.coroutine && !is_yield_expression && ((MemberAccess) 
call).member_name != "end") {
                                // .begin call of async method, no error can happen here
                        } else {
-                               foreach (DataType error_type in m.get_error_types ()) {
+                               m.get_error_types ().foreach ((error_type) => {
                                        may_throw = true;
 
                                        // ensure we can trace back which expression may throw errors of this 
type
@@ -511,7 +517,8 @@ public class Vala.MethodCall : Expression {
                                        call_error_type.source_reference = source_reference;
 
                                        add_error_type (call_error_type);
-                               }
+                                       return true;
+                               });
                        }
                        if (m.returns_floating_reference) {
                                value_type.floating_reference = true;
@@ -524,14 +531,15 @@ public class Vala.MethodCall : Expression {
                        if (dynamic_sig != null && dynamic_sig.handler != null) {
                                dynamic_sig.return_type = dynamic_sig.handler.value_type.get_return_type 
().copy ();
                                bool first = true;
-                               foreach (Parameter param in dynamic_sig.handler.value_type.get_parameters ()) 
{
+                               dynamic_sig.handler.value_type.get_parameters ().foreach ((param) => {
                                        if (first) {
                                                // skip sender parameter
                                                first = false;
                                        } else {
                                                dynamic_sig.add_parameter (param.copy ());
                                        }
-                               }
+                                       return true;
+                               });
                                dynamic_sig.handler.target_type = new DelegateType (dynamic_sig.get_delegate 
(new ObjectType ((ObjectTypeSymbol) dynamic_sig.parent_symbol), this));
                        }
 
@@ -544,9 +552,9 @@ public class Vala.MethodCall : Expression {
 
                                                // infer type arguments from arguments
                                                arg_it = args.iterator ();
-                                               foreach (Parameter param in params) {
+                                               params.foreach ((param) => {
                                                        if (param.ellipsis || param.params_array) {
-                                                               break;
+                                                               return false;
                                                        }
 
                                                        if (arg_it.next ()) {
@@ -554,12 +562,13 @@ public class Vala.MethodCall : Expression {
 
                                                                type_arg = 
param.variable_type.infer_type_argument (type_param, arg.value_type);
                                                                if (type_arg != null) {
-                                                                       break;
+                                                                       return false;
                                                                }
 
                                                                arg.target_type = 
arg.formal_target_type.get_actual_type (target_object_type, method_type_args, this);
                                                        }
-                                               }
+                                                       return true;
+                                               });
 
                                                // infer type arguments from expected return type
                                                if (type_arg == null && target_type != null) {
@@ -577,9 +586,9 @@ public class Vala.MethodCall : Expression {
 
                                        // recalculate argument target types with new information
                                        arg_it = args.iterator ();
-                                       foreach (Parameter param in params) {
+                                       params.foreach ((param) => {
                                                if (param.ellipsis || param.params_array) {
-                                                       break;
+                                                       return false;
                                                }
 
                                                if (arg_it.next ()) {
@@ -587,7 +596,8 @@ public class Vala.MethodCall : Expression {
 
                                                        arg.target_type = 
arg.formal_target_type.get_actual_type (target_object_type, method_type_args, this);
                                                }
-                                       }
+                                               return true;
+                                       });
 
                                        // recalculate return value type with new information
                                        value_type = formal_value_type.get_actual_type (target_object_type, 
method_type_args, this);
@@ -597,7 +607,7 @@ public class Vala.MethodCall : Expression {
                        // constructor
                        var cl = (Class) ((ObjectType) mtype).type_symbol;
                        var m = cl.default_construction_method;
-                       foreach (DataType error_type in m.get_error_types ()) {
+                       m.get_error_types ().foreach ((error_type) => {
                                may_throw = true;
 
                                // ensure we can trace back which expression may throw errors of this type
@@ -605,10 +615,11 @@ public class Vala.MethodCall : Expression {
                                call_error_type.source_reference = source_reference;
 
                                add_error_type (call_error_type);
-                       }
+                               return true;
+                       });
                } else if (mtype is DelegateType) {
                        var d = ((DelegateType) mtype).delegate_symbol;
-                       foreach (DataType error_type in d.get_error_types ()) {
+                       d.get_error_types ().foreach ((error_type) => {
                                may_throw = true;
 
                                // ensure we can trace back which expression may throw errors of this type
@@ -616,7 +627,8 @@ public class Vala.MethodCall : Expression {
                                call_error_type.source_reference = source_reference;
 
                                add_error_type (call_error_type);
-                       }
+                               return true;
+                       });
                }
 
                if (!context.analyzer.check_arguments (this, mtype, params, get_argument_list ())) {
@@ -698,9 +710,10 @@ public class Vala.MethodCall : Expression {
                        call.emit (codegen);
                }
 
-               foreach (Expression expr in argument_list) {
+               argument_list.foreach ((expr) => {
                        expr.emit (codegen);
-               }
+                       return true;
+               });
 
                codegen.visit_method_call (this);
 
@@ -710,17 +723,19 @@ public class Vala.MethodCall : Expression {
        public override void get_defined_variables (Collection<Variable> collection) {
                call.get_defined_variables (collection);
 
-               foreach (Expression arg in argument_list) {
+               argument_list.foreach ((arg) => {
                        arg.get_defined_variables (collection);
-               }
+                       return true;
+               });
        }
 
        public override void get_used_variables (Collection<Variable> collection) {
                call.get_used_variables (collection);
 
-               foreach (Expression arg in argument_list) {
+               argument_list.foreach ((arg) => {
                        arg.get_used_variables (collection);
-               }
+                       return true;
+               });
        }
 
        public StringLiteral? get_format_literal () {
diff --git a/vala/valamethodtype.vala b/vala/valamethodtype.vala
index 9a492fa..0675924 100644
--- a/vala/valamethodtype.vala
+++ b/vala/valamethodtype.vala
@@ -77,14 +77,14 @@ public class Vala.MethodType : DataType {
                var proto = "%s %s (".printf (get_return_type ().to_string (), this.to_string ());
 
                int i = 1;
-               foreach (Parameter param in get_parameters ()) {
+               get_parameters ().foreach ((param) => {
                        if (i > 1) {
                                proto += ", ";
                        }
 
                        if (param.ellipsis) {
                                proto += "...";
-                               continue;
+                               return true;
                        }
 
                        if (param.direction == ParameterDirection.IN) {
@@ -109,7 +109,8 @@ public class Vala.MethodType : DataType {
                        }
 
                        i++;
-               }
+                       return true;
+               });
 
                return proto + ")";
        }
diff --git a/vala/valanamespace.vala b/vala/valanamespace.vala
index 47dd4ee..d43f5bb 100644
--- a/vala/valanamespace.vala
+++ b/vala/valanamespace.vala
@@ -93,42 +93,54 @@ public class Vala.Namespace : Symbol {
                                old_ns.source_reference = ns.source_reference;
                        }
 
-                       foreach (var using_directive in ns.using_directives) {
+                       ns.using_directives.foreach ((using_directive) => {
                                old_ns.add_using_directive (using_directive);
-                       }
-                       foreach (Namespace sub_ns in ns.get_namespaces ()) {
+                               return true;
+                       });
+                       ns.get_namespaces ().foreach ((sub_ns) => {
                                old_ns.add_namespace (sub_ns);
-                       }
-                       foreach (Class cl in ns.get_classes ()) {
+                               return true;
+                       });
+                       ns.get_classes ().foreach ((cl) => {
                                old_ns.add_class (cl);
-                       }
-                       foreach (Struct st in ns.get_structs ()) {
+                               return true;
+                       });
+                       ns.get_structs ().foreach ((st) => {
                                old_ns.add_struct (st);
-                       }
-                       foreach (Interface iface in ns.get_interfaces ()) {
+                               return true;
+                       });
+                       ns.get_interfaces ().foreach ((iface) => {
                                old_ns.add_interface (iface);
-                       }
-                       foreach (Delegate d in ns.get_delegates ()) {
+                               return true;
+                       });
+                       ns.get_delegates ().foreach ((d) => {
                                old_ns.add_delegate (d);
-                       }
-                       foreach (Enum en in ns.get_enums ()) {
+                               return true;
+                       });
+                       ns.get_enums ().foreach ((en) => {
                                old_ns.add_enum (en);
-                       }
-                       foreach (ErrorDomain ed in ns.get_error_domains ()) {
+                               return true;
+                       });
+                       ns.get_error_domains ().foreach ((ed) => {
                                old_ns.add_error_domain (ed);
-                       }
-                       foreach (Constant c in ns.get_constants ()) {
+                               return true;
+                       });
+                       ns.get_constants ().foreach ((c) => {
                                old_ns.add_constant (c);
-                       }
-                       foreach (Field f in ns.get_fields ()) {
+                               return true;
+                       });
+                       ns.get_fields ().foreach ((f) => {
                                old_ns.add_field (f);
-                       }
-                       foreach (Method m in ns.get_methods ()) {
+                               return true;
+                       });
+                       ns.get_methods ().foreach ((m) => {
                                old_ns.add_method (m);
-                       }
-                       foreach (Comment c in ns.get_comments ()) {
+                               return true;
+                       });
+                       ns.get_comments ().foreach ((c) => {
                                old_ns.add_comment (c);
-                       }
+                               return true;
+                       });
                        foreach (Attribute a in ns.attributes) {
                                if (old_ns.get_attribute (a.name) == null) {
                                        old_ns.attributes.append(a);
@@ -456,50 +468,61 @@ public class Vala.Namespace : Symbol {
        }
 
        public override void accept_children (CodeVisitor visitor) {
-               foreach (UsingDirective ns_ref in using_directives) {
+               using_directives.foreach ((ns_ref) => {
                        ns_ref.accept (visitor);
-               }
+                       return true;
+               });
 
-               foreach (Namespace ns in namespaces) {
+               namespaces.foreach ((ns) => {
                        ns.accept (visitor);
-               }
+                       return true;
+               });
 
                /* process enums first to avoid order problems in C code */
-               foreach (Enum en in enums) {
+               enums.foreach ((en) => {
                        en.accept (visitor);
-               }
+                       return true;
+               });
 
-               foreach (ErrorDomain edomain in error_domains) {
+               error_domains.foreach ((edomain) => {
                        edomain.accept (visitor);
-               }
+                       return true;
+               });
 
-               foreach (Class cl in classes) {
+               classes.foreach ((cl) => {
                        cl.accept (visitor);
-               }
+                       return true;
+               });
 
-               foreach (Interface iface in interfaces) {
+               interfaces.foreach ((iface) => {
                        iface.accept (visitor);
-               }
+                       return true;
+               });
 
-               foreach (Struct st in structs) {
+               structs.foreach ((st) => {
                        st.accept (visitor);
-               }
+                       return true;
+               });
 
-               foreach (Delegate d in delegates) {
+               delegates.foreach ((d) => {
                        d.accept (visitor);
-               }
+                       return true;
+               });
 
-               foreach (Constant c in constants) {
+               constants.foreach ((c) => {
                        c.accept (visitor);
-               }
+                       return true;
+               });
 
-               foreach (Field f in fields) {
+               fields.foreach ((f) => {
                        f.accept (visitor);
-               }
+                       return true;
+               });
 
-               foreach (Method m in methods) {
+               methods.foreach ((m) => {
                        m.accept (visitor);
-               }
+                       return true;
+               });
        }
 
        public override bool check (CodeContext context) {
diff --git a/vala/valaobjectcreationexpression.vala b/vala/valaobjectcreationexpression.vala
index c4b119a..ebf7917 100644
--- a/vala/valaobjectcreationexpression.vala
+++ b/vala/valaobjectcreationexpression.vala
@@ -118,13 +118,15 @@ public class Vala.ObjectCreationExpression : Expression {
                        member_name.accept (visitor);
                }
                
-               foreach (Expression arg in argument_list) {
+               argument_list.foreach ((arg) => {
                        arg.accept (visitor);
-               }
+                       return true;
+               });
 
-               foreach (MemberInitializer init in object_initializer) {
+               object_initializer.foreach ((init) => {
                        init.accept (visitor);
-               }
+                       return true;
+               });
        }
 
        public override void replace_expression (Expression old_node, Expression new_node) {
@@ -236,9 +238,10 @@ public class Vala.ObjectCreationExpression : Expression {
                                return false;
                        }
 
-                       foreach (DataType type_arg in type_args) {
+                       type_args.foreach ((type_arg) => {
                                type_reference.add_type_argument (type_arg);
-                       }
+                               return true;
+                       });
                } else {
                        type = type_reference.data_type;
                }
@@ -367,9 +370,9 @@ public class Vala.ObjectCreationExpression : Expression {
 
                        var args = get_argument_list ();
                        Iterator<Expression> arg_it = args.iterator ();
-                       foreach (Parameter param in m.get_parameters ()) {
+                       m.get_parameters ().foreach ((param) => {
                                if (param.ellipsis) {
-                                       break;
+                                       return false;
                                }
 
                                if (arg_it.next ()) {
@@ -381,7 +384,8 @@ public class Vala.ObjectCreationExpression : Expression {
 
                                        last_arg = arg;
                                }
-                       }
+                               return true;
+                       });
 
                        // printf arguments
                        if (m.printf_format) {
@@ -413,13 +417,14 @@ public class Vala.ObjectCreationExpression : Expression {
                                }
                        }
 
-                       foreach (Expression arg in args) {
+                       args.foreach ((arg) => {
                                arg.check (context);
-                       }
+                               return true;
+                       });
 
                        context.analyzer.check_arguments (this, new MethodType (m), m.get_parameters (), 
args);
 
-                       foreach (DataType error_type in m.get_error_types ()) {
+                       m.get_error_types ().foreach ((error_type) => {
                                may_throw = true;
 
                                // ensure we can trace back which expression may throw errors of this type
@@ -427,7 +432,8 @@ public class Vala.ObjectCreationExpression : Expression {
                                call_error_type.source_reference = source_reference;
 
                                add_error_type (call_error_type);
-                       }
+                               return true;
+                       });
                } else if (type_reference is ErrorType) {
                        if (type_reference != null) {
                                type_reference.check (context);
@@ -437,13 +443,15 @@ public class Vala.ObjectCreationExpression : Expression {
                                member_name.check (context);
                        }
                
-                       foreach (Expression arg in argument_list) {
+                       argument_list.foreach ((arg) => {
                                arg.check (context);
-                       }
+                               return true;
+                       });
 
-                       foreach (MemberInitializer init in object_initializer) {
+                       object_initializer.foreach ((init) => {
                                init.check (context);
-                       }
+                               return true;
+                       });
 
                        if (get_argument_list ().size == 0) {
                                error = true;
@@ -475,9 +483,10 @@ public class Vala.ObjectCreationExpression : Expression {
                        }
                }
 
-               foreach (MemberInitializer init in get_object_initializer ()) {
+               get_object_initializer ().foreach ((init) => {
                        context.analyzer.visit_member_initializer (init, type_reference);
-               }
+                       return true;
+               });
 
                if (may_throw) {
                        if (parent_node is LocalVariable || parent_node is ExpressionStatement) {
@@ -516,13 +525,15 @@ public class Vala.ObjectCreationExpression : Expression {
        }
 
        public override void emit (CodeGenerator codegen) {
-               foreach (Expression arg in argument_list) {
+               argument_list.foreach ((arg) => {
                        arg.emit (codegen);
-               }
+                       return true;
+               });
 
-               foreach (MemberInitializer init in object_initializer) {
+               object_initializer.foreach ((init) => {
                        init.emit (codegen);
-               }
+                       return true;
+               });
 
                codegen.visit_object_creation_expression (this);
 
@@ -530,18 +541,21 @@ public class Vala.ObjectCreationExpression : Expression {
        }
 
        public override void get_defined_variables (Collection<Variable> collection) {
-               foreach (Expression arg in argument_list) {
+               argument_list.foreach ((arg) => {
                        arg.get_defined_variables (collection);
-               }
+                       return true;
+               });
        }
 
        public override void get_used_variables (Collection<Variable> collection) {
-               foreach (Expression arg in argument_list) {
+               argument_list.foreach ((arg) => {
                        arg.get_used_variables (collection);
-               }
+                       return true;
+               });
 
-               foreach (MemberInitializer init in object_initializer) {
+               object_initializer.foreach ((init) => {
                        init.get_used_variables (collection);
-               }
+                       return true;
+               });
        }
 }
diff --git a/vala/valaobjecttype.vala b/vala/valaobjecttype.vala
index eccdbbd..4748611 100644
--- a/vala/valaobjecttype.vala
+++ b/vala/valaobjecttype.vala
@@ -44,9 +44,10 @@ public class Vala.ObjectType : ReferenceType {
                result.is_dynamic = is_dynamic;
                result.floating_reference = floating_reference;
                
-               foreach (DataType arg in get_type_arguments ()) {
+               get_type_arguments ().foreach ((arg) => {
                        result.add_type_argument (arg.copy ());
-               }
+                       return true;
+               });
                
                return result;
        }
diff --git a/vala/valaobjecttypesymbol.vala b/vala/valaobjecttypesymbol.vala
index 14fc230..e473695 100644
--- a/vala/valaobjecttypesymbol.vala
+++ b/vala/valaobjecttypesymbol.vala
@@ -71,11 +71,12 @@ public abstract class Vala.ObjectTypeSymbol : TypeSymbol {
 
        public ObjectType get_this_type () {
                var result = new ObjectType (this);
-               foreach (var type_parameter in get_type_parameters ()) {
+               get_type_parameters ().foreach ((type_parameter) => {
                        var type_arg = new GenericType (type_parameter);
                        type_arg.value_owned = true;
                        result.add_type_argument (type_arg);
-               }
+                       return true;
+               });
                return result;
        }
 
diff --git a/vala/valaparser.vala b/vala/valaparser.vala
index 6f41fc9..dd10f50 100644
--- a/vala/valaparser.vala
+++ b/vala/valaparser.vala
@@ -465,9 +465,10 @@ public class Vala.Parser : CodeVisitor {
                                
                                type = new UnresolvedType.from_symbol (sym, get_src (begin));
                                if (type_arg_list != null) {
-                                       foreach (DataType type_arg in type_arg_list) {
+                                       type_arg_list.foreach ((type_arg) => {
                                                type.add_type_argument (type_arg);
-                                       }
+                                               return true;
+                                       });
                                }
                        }
                        
@@ -684,9 +685,10 @@ public class Vala.Parser : CodeVisitor {
                var expr = new MemberAccess (null, id, get_src (begin));
                expr.qualified = qualified;
                if (type_arg_list != null) {
-                       foreach (DataType type_arg in type_arg_list) {
+                       type_arg_list.foreach ((type_arg) => {
                                expr.add_type_argument (type_arg);
-                       }
+                               return true;
+                       });
                }
                return expr;
        }
@@ -704,9 +706,10 @@ public class Vala.Parser : CodeVisitor {
                expect (TokenType.CLOSE_PARENS);
                if (expr_list.size != 1) {
                        var tuple = new Tuple (get_src (begin));
-                       foreach (Expression expr in expr_list) {
+                       expr_list.foreach ((expr) => {
                                tuple.add_expression (expr);
-                       }
+                               return true;
+                       });
                        return tuple;
                }
                return expr_list.get (0);
@@ -741,9 +744,10 @@ public class Vala.Parser : CodeVisitor {
                List<DataType> type_arg_list = parse_type_argument_list (true);
                var expr = new MemberAccess (inner, id, get_src (begin));
                if (type_arg_list != null) {
-                       foreach (DataType type_arg in type_arg_list) {
+                       type_arg_list.foreach ((type_arg) => {
                                expr.add_type_argument (type_arg);
-                       }
+                               return true;
+                       });
                }
                return expr;
        }
@@ -754,9 +758,10 @@ public class Vala.Parser : CodeVisitor {
                List<DataType> type_arg_list = parse_type_argument_list (true);
                var expr = new MemberAccess.pointer (inner, id, get_src (begin));
                if (type_arg_list != null) {
-                       foreach (DataType type_arg in type_arg_list) {
+                       type_arg_list.foreach ((type_arg) => {
                                expr.add_type_argument (type_arg);
-                       }
+                               return true;
+                       });
                }
                return expr;
        }
@@ -774,18 +779,21 @@ public class Vala.Parser : CodeVisitor {
 
                        var expr = new ObjectCreationExpression (member, get_src (begin));
                        expr.struct_creation = true;
-                       foreach (Expression arg in arg_list) {
+                       arg_list.foreach ((arg) => {
                                expr.add_argument (arg);
-                       }
-                       foreach (MemberInitializer initializer in init_list) {
+                               return true;
+                       });
+                       init_list.foreach ((initializer) => {
                                expr.add_member_initializer (initializer);
-                       }
+                               return true;
+                       });
                        return expr;
                } else {
                        var expr = new MethodCall (inner, get_src (begin));
-                       foreach (Expression arg in arg_list) {
+                       arg_list.foreach ((arg) => {
                                expr.add_argument (arg);
-                       }
+                               return true;
+                       });
                        return expr;
                }
        }
@@ -802,9 +810,10 @@ public class Vala.Parser : CodeVisitor {
 
                if (stop == null) {
                        var expr = new ElementAccess (inner, get_src (begin));
-                       foreach (Expression index in index_list) {
+                       index_list.foreach ((index) => {
                                expr.append_index (index);
-                       }
+                               return true;
+                       });
                        return expr;
                } else {
                        return new SliceExpression (inner, index_list[0], stop, get_src (begin));
@@ -879,12 +888,14 @@ public class Vala.Parser : CodeVisitor {
                var init_list = parse_object_initializer ();
 
                var expr = new ObjectCreationExpression (member, get_src (begin));
-               foreach (Expression arg in arg_list) {
+               arg_list.foreach ((arg) => {
                        expr.add_argument (arg);
-               }
-               foreach (MemberInitializer initializer in init_list) {
+                       return true;
+               });
+               init_list.foreach ((initializer) => {
                        expr.add_member_initializer (initializer);
-               }
+                       return true;
+               });
                return expr;
        }
 
@@ -954,9 +965,10 @@ public class Vala.Parser : CodeVisitor {
                }
                var expr = new ArrayCreationExpression (element_type, size_specifier_list.size, initializer, 
get_src (begin));
                if (size_specified) {
-                       foreach (Expression size in size_specifier_list) {
+                       size_specifier_list.foreach ((size) => {
                                expr.append_size (size);
-                       }
+                               return true;
+                       });
                }
                return expr;
        }
@@ -1452,9 +1464,10 @@ public class Vala.Parser : CodeVisitor {
                        var expr = parse_expression ();
                        lambda = new LambdaExpression (expr, get_src (begin));
                }
-               foreach (var param in params) {
+               params.foreach ((param) => {
                        lambda.add_parameter (param);
-               }
+                       return true;
+               });
                return lambda;
        }
 
@@ -1986,12 +1999,14 @@ public class Vala.Parser : CodeVisitor {
                var src = get_src (begin);
                var body = parse_embedded_statement ("for");
                var stmt = new ForStatement (condition, body, src);
-               foreach (Expression init in initializer_list) {
+               initializer_list.foreach ((init) => {
                        stmt.add_initializer (init);
-               }
-               foreach (Expression iter in iterator_list) {
+                       return true;
+               });
+               iterator_list.foreach ((iter) => {
                        stmt.add_iterator (iter);
-               }
+                       return true;
+               });
                if (block != null) {
                        block.add_statement (stmt);
                        return block;
@@ -2184,12 +2199,13 @@ public class Vala.Parser : CodeVisitor {
 
        void set_attributes (CodeNode node, List<Attribute>? attributes) {
                if (attributes != null) {
-                       foreach (Attribute attr in (List<Attribute>) attributes) {
+                       attributes.foreach ((attr) => {
                                if (node.get_attribute (attr.name) != null) {
                                        Report.error (attr.source_reference, "duplicate attribute 
`%s`".printf (attr.name));
                                }
                                node.attributes.append (attr);
-                       }
+                               return true;
+                       });
                }
        }
 
@@ -2519,12 +2535,14 @@ public class Vala.Parser : CodeVisitor {
                        cl.external = true;
                }
                set_attributes (cl, attrs);
-               foreach (TypeParameter type_param in type_param_list) {
+               type_param_list.foreach ((type_param) => {
                        cl.add_type_parameter (type_param);
-               }
-               foreach (DataType base_type in base_types) {
+                       return true;
+               });
+               base_types.foreach ((base_type) => {
                        cl.add_base_type (base_type);
-               }
+                       return true;
+               });
 
                parse_declarations (cl);
 
@@ -2662,9 +2680,10 @@ public class Vala.Parser : CodeVisitor {
                }
                method.access = access;
                set_attributes (method, attrs);
-               foreach (TypeParameter type_param in type_param_list) {
+               type_param_list.foreach ((type_param) => {
                        method.add_type_parameter (type_param);
-               }
+                       return true;
+               });
                if (ModifierFlags.STATIC in flags && ModifierFlags.CLASS in flags) {
                        Report.error (method.source_reference, "only one of `static' or `class' may be 
specified");
                } else if (ModifierFlags.STATIC in flags) {
@@ -2982,9 +3001,10 @@ public class Vala.Parser : CodeVisitor {
                        st.external = true;
                }
                set_attributes (st, attrs);
-               foreach (TypeParameter type_param in type_param_list) {
+               type_param_list.foreach ((type_param) => {
                        st.add_type_parameter (type_param);
-               }
+                       return true;
+               });
                if (base_type != null) {
                        st.base_type = base_type;
                }
@@ -3025,12 +3045,14 @@ public class Vala.Parser : CodeVisitor {
                        iface.external = true;
                }
                set_attributes (iface, attrs);
-               foreach (TypeParameter type_param in type_param_list) {
+               type_param_list.foreach ((type_param) => {
                        iface.add_type_parameter (type_param);
-               }
-               foreach (DataType base_type in base_types) {
+                       return true;
+               });
+               base_types.foreach ((base_type) => {
                        iface.add_prerequisite (base_type);
-               }
+                       return true;
+               });
 
                parse_declarations (iface);
 
@@ -3372,9 +3394,10 @@ public class Vala.Parser : CodeVisitor {
                if (ModifierFlags.EXTERN in flags || scanner.source_file.file_type == SourceFileType.PACKAGE) 
{
                        d.external = true;
                }
-               foreach (TypeParameter type_param in type_param_list) {
+               type_param_list.foreach ((type_param) => {
                        d.add_type_parameter (type_param);
-               }
+                       return true;
+               });
                expect (TokenType.OPEN_PARENS);
                if (current () != TokenType.CLOSE_PARENS) {
                        do {
@@ -3500,9 +3523,10 @@ public class Vala.Parser : CodeVisitor {
                        expr = new MemberAccess (expr != null ? expr : base_expr, id, get_src (begin));
                        expr.qualified = qualified;
                        if (type_arg_list != null) {
-                               foreach (DataType type_arg in type_arg_list) {
+                               type_arg_list.foreach ((type_arg) => {
                                        expr.add_type_argument (type_arg);
-                               }
+                                       return true;
+                               });
                        }
 
                        first = false;
diff --git a/vala/valaproperty.vala b/vala/valaproperty.vala
index bc6b18e..0fb34aa 100644
--- a/vala/valaproperty.vala
+++ b/vala/valaproperty.vala
@@ -354,7 +354,7 @@ public class Vala.Property : Symbol, Lockable {
 
        private void find_base_interface_property (Class cl) {
                // FIXME report error if multiple possible base properties are found
-               foreach (DataType type in cl.get_base_types ()) {
+               cl.get_base_types ().foreach ((type) => {
                        if (type.data_type is Interface) {
                                var sym = type.data_type.scope.lookup (name);
                                if (sym is Property) {
@@ -364,15 +364,16 @@ public class Vala.Property : Symbol, Lockable {
                                                if (!compatible (base_property, out invalid_match)) {
                                                        error = true;
                                                        Report.error (source_reference, "Type and/or 
accessors of overriding property `%s' do not match overridden property `%s': %s.".printf (get_full_name (), 
base_property.get_full_name (), invalid_match));
-                                                       return;
+                                                       return false;
                                                }
 
                                                _base_interface_property = base_property;
-                                               return;
+                                               return false;
                                        }
                                }
                        }
-               }
+                       return true;
+               });
        }
 
        public override bool check (CodeContext context) {
diff --git a/vala/valapropertyaccessor.vala b/vala/valapropertyaccessor.vala
index 9004848..90c0171 100644
--- a/vala/valapropertyaccessor.vala
+++ b/vala/valapropertyaccessor.vala
@@ -185,11 +185,12 @@ public class Vala.PropertyAccessor : Subroutine {
 
                        body.check (context);
 
-                       foreach (DataType body_error_type in body.get_error_types ()) {
+                       body.get_error_types ().foreach ((body_error_type) => {
                                if (!((ErrorType) body_error_type).dynamic_error) {
                                        Report.warning (body_error_type.source_reference, "unhandled error 
`%s'".printf (body_error_type.to_string()));
                                }
-                       }
+                               return true;
+                       });
                }
 
                context.analyzer.current_symbol = old_symbol;
diff --git a/vala/valasemanticanalyzer.vala b/vala/valasemanticanalyzer.vala
index f3b1a63..f7e8629 100644
--- a/vala/valasemanticanalyzer.vala
+++ b/vala/valasemanticanalyzer.vala
@@ -369,11 +369,12 @@ public class Vala.SemanticAnalyzer : CodeVisitor {
                }
 
                if (type_parameters != null) {
-                       foreach (var type_param in type_parameters) {
+                       type_parameters.foreach ((type_param) => {
                                var type_arg = new GenericType (type_param);
                                type_arg.value_owned = true;
                                type.add_type_argument (type_arg);
-                       }
+                               return true;
+                       });
                }
 
                return type;
@@ -732,11 +733,12 @@ public class Vala.SemanticAnalyzer : CodeVisitor {
                } else {
                        assert_not_reached ();
                }
-               foreach (DataType type_arg in base_type.get_type_arguments ()) {
+               base_type.get_type_arguments ().foreach ((type_arg) => {
                        // resolve type argument specified in base type (possibly recursively for nested 
generic types)
                        type_arg = type_arg.get_actual_type (instance_type, null, node_reference);
                        instance_base_type.add_type_argument (type_arg);
-               }
+                       return true;
+               });
                return instance_base_type;
        }
 
diff --git a/vala/valasignal.vala b/vala/valasignal.vala
index d11180f..2a99ef8 100644
--- a/vala/valasignal.vala
+++ b/vala/valasignal.vala
@@ -119,7 +119,7 @@ public class Vala.Signal : Symbol, Lockable, Callable {
 
                bool is_generic = false;
 
-               foreach (Parameter param in parameters) {
+               parameters.foreach ((param) => {
                        var actual_param = param.copy ();
                        actual_param.variable_type = actual_param.variable_type.get_actual_type (sender_type, 
null, node_reference);
                        generated_delegate.add_parameter (actual_param);
@@ -127,13 +127,15 @@ public class Vala.Signal : Symbol, Lockable, Callable {
                        if (actual_param.variable_type is GenericType) {
                                is_generic = true;
                        }
-               }
+                       return true;
+               });
 
                if (is_generic) {
                        var cl = (ObjectTypeSymbol) parent_symbol;
-                       foreach (var type_param in cl.get_type_parameters ()) {
+                       cl.get_type_parameters ().foreach ((type_param) => {
                                generated_delegate.add_type_parameter (new TypeParameter (type_param.name, 
type_param.source_reference));
-                       }
+                               return true;
+                       });
 
                        // parameter types must refer to the delegate type parameters
                        // instead of to the class type parameters
@@ -156,9 +158,10 @@ public class Vala.Signal : Symbol, Lockable, Callable {
        public override void accept_children (CodeVisitor visitor) {
                return_type.accept (visitor);
                
-               foreach (Parameter param in parameters) {
+               parameters.foreach ((param) => {
                        param.accept (visitor);
-               }
+                       return true;
+               });
                if (default_handler == null && body != null) {
                        body.accept (visitor);
                } else if (default_handler != null) {
@@ -218,9 +221,10 @@ public class Vala.Signal : Symbol, Lockable, Callable {
                        default_handler.body = body;
 
 
-                       foreach (Parameter param in parameters) {
+                       parameters.foreach ((param) => {
                                default_handler.add_parameter (param);
-                       }
+                               return true;
+                       });
 
                        var cl = parent_symbol as ObjectTypeSymbol;
 
diff --git a/vala/valasignaltype.vala b/vala/valasignaltype.vala
index 237a549..a6490df 100644
--- a/vala/valasignaltype.vala
+++ b/vala/valasignaltype.vala
@@ -67,11 +67,12 @@ public class Vala.SignalType : DataType {
                result.value_owned = true;
 
                if (result.delegate_symbol.get_type_parameters ().size > 0) {
-                       foreach (var type_param in type_sym.get_type_parameters ()) {
+                       type_sym.get_type_parameters ().foreach ((type_param) => {
                                var type_arg = new GenericType (type_param);
                                type_arg.value_owned = true;
                                result.add_type_argument (type_arg);
-                       }
+                               return true;
+                       });
                }
 
                return result;
diff --git a/vala/valasourcefile.vala b/vala/valasourcefile.vala
index 04dfeff..a8f63c1 100644
--- a/vala/valasourcefile.vala
+++ b/vala/valasourcefile.vala
@@ -199,9 +199,10 @@ public class Vala.SourceFile {
                // for correct symbol resolving
                var old_using_directives = current_using_directives;
                current_using_directives = new ArrayList<UsingDirective> ();
-               foreach (var using_directive in old_using_directives) {
+               old_using_directives.foreach ((using_directive) => {
                        current_using_directives.add (using_directive);
-               }
+                       return true;
+               });
                current_using_directives.add (ns);
        }
 
@@ -232,9 +233,10 @@ public class Vala.SourceFile {
        }
 
        public void accept_children (CodeVisitor visitor) {
-               foreach (CodeNode node in nodes) {
+               nodes.foreach ((node) => {
                        node.accept (visitor);
-               }
+                       return true;
+               });
        }
 
        private string get_subdir () {
@@ -382,9 +384,10 @@ public class Vala.SourceFile {
        }
 
        public bool check (CodeContext context) {
-               foreach (CodeNode node in nodes) {
+               nodes.foreach ((node) => {
                        node.check (context);
-               }
+                       return true;
+               });
                return true;
        }
 }
diff --git a/vala/valastatementlist.vala b/vala/valastatementlist.vala
index 934227a..3319f92 100644
--- a/vala/valastatementlist.vala
+++ b/vala/valastatementlist.vala
@@ -49,14 +49,16 @@ public class Vala.StatementList : CodeNode, Statement {
        }
 
        public override void accept (CodeVisitor visitor) {
-               foreach (Statement stmt in list) {
+               list.foreach ((stmt) => {
                        stmt.accept (visitor);
-               }
+                       return true;
+               });
        }
 
        public override void emit (CodeGenerator codegen) {
-               foreach (Statement stmt in list) {
+               list.foreach ((stmt) => {
                        stmt.emit (codegen);
-               }
+                       return true;
+               });
        }
 }
diff --git a/vala/valastruct.vala b/vala/valastruct.vala
index 21985d7..fc008b6 100644
--- a/vala/valastruct.vala
+++ b/vala/valastruct.vala
@@ -273,25 +273,30 @@ public class Vala.Struct : TypeSymbol {
                        base_type.accept (visitor);
                }
 
-               foreach (TypeParameter p in type_parameters) {
+               type_parameters.foreach ((p) => {
                        p.accept (visitor);
-               }
+                       return true;
+               });
                
-               foreach (Field f in fields) {
+               fields.foreach ((f) => {
                        f.accept (visitor);
-               }
+                       return true;
+               });
                
-               foreach (Constant c in constants) {
+               constants.foreach ((c) => {
                        c.accept (visitor);
-               }
+                       return true;
+               });
                
-               foreach (Method m in methods) {
+               methods.foreach ((m) => {
                        m.accept (visitor);
-               }
+                       return true;
+               });
 
-               foreach (Property prop in properties) {
+               properties.foreach ((prop) => {
                        prop.accept (visitor);
-               }
+                       return true;
+               });
        }
 
        /**
@@ -448,14 +453,10 @@ public class Vala.Struct : TypeSymbol {
                        return true;
                }
 
-               foreach (Field f in fields) {
-                       if (f.binding == MemberBinding.INSTANCE
-                           && f.variable_type.is_disposable ()) {
-                               return true;
-                       }
-               }
-
-               return false;
+               return !fields.foreach ((f) => {
+                       return !(f.binding == MemberBinding.INSTANCE
+                                        && f.variable_type.is_disposable ());
+               });
        }
 
        bool is_recursive_value_type (DataType type) {
@@ -465,11 +466,9 @@ public class Vala.Struct : TypeSymbol {
                        if (st == this) {
                                return true;
                        }
-                       foreach (Field f in st.fields) {
-                               if (f.binding == MemberBinding.INSTANCE && is_recursive_value_type 
(f.variable_type)) {
-                                       return true;
-                               }
-                       }
+                       return !st.fields.foreach ((f) => {
+                               return !(f.binding == MemberBinding.INSTANCE && is_recursive_value_type 
(f.variable_type));
+                       });
                }
                return false;
        }
@@ -499,9 +498,10 @@ public class Vala.Struct : TypeSymbol {
                        }
                }
 
-               foreach (TypeParameter p in type_parameters) {
+               type_parameters.foreach ((p) => {
                        p.check (context);
-               }
+                       return true;
+               });
 
                foreach (Field f in fields) {
                        f.check (context);
@@ -519,30 +519,34 @@ public class Vala.Struct : TypeSymbol {
                        }
                }
 
-               foreach (Constant c in constants) {
+               constants.foreach ((c) => {
                        c.check (context);
-               }
+                       return true;
+               });
 
-               foreach (Method m in methods) {
+               methods.foreach ((m) => {
                        m.check (context);
-               }
+                       return true;
+               });
 
-               foreach (Property prop in properties) {
+               properties.foreach ((prop) => {
                        prop.check (context);
-               }
+                       return true;
+               });
 
                if (!external && !external_package) {
                        if (base_type == null && get_fields ().size == 0 && !is_boolean_type () && 
!is_integer_type () && !is_floating_type ()) {
                                error = true;
                                Report.error (source_reference, "structs cannot be empty: %s".printf(name));
                        } else if (base_type != null) {
-                               foreach (Field f in fields) {
+                               fields.foreach ((f) => {
                                        if (f.binding == MemberBinding.INSTANCE) {
                                                error = true;
                                                Report.error (source_reference, "derived structs may not have 
instance fields");
-                                               break;
+                                               return false;
                                        }
-                               }
+                                       return true;
+                               });
                        }
                }
 
diff --git a/vala/valastructvaluetype.vala b/vala/valastructvaluetype.vala
index 5561627..eae532b 100644
--- a/vala/valastructvaluetype.vala
+++ b/vala/valastructvaluetype.vala
@@ -63,9 +63,10 @@ public class Vala.StructValueType : ValueType {
                result.value_owned = value_owned;
                result.nullable = nullable;
 
-               foreach (DataType arg in get_type_arguments ()) {
+               get_type_arguments ().foreach ((arg) => {
                        result.add_type_argument (arg.copy ());
-               }
+                       return true;
+               });
 
                return result;
        }
diff --git a/vala/valaswitchsection.vala b/vala/valaswitchsection.vala
index bf9932f..fce1e77 100644
--- a/vala/valaswitchsection.vala
+++ b/vala/valaswitchsection.vala
@@ -62,13 +62,9 @@ public class Vala.SwitchSection : Block {
        }
        
        public bool has_default_label () {
-               foreach (SwitchLabel label in labels) {
-                       if (label.expression == null) {
-                               return true;
-                       }
-               }
-               
-               return false;
+               return !labels.foreach ((label) => {
+                       return label.expression != null;
+               });
        }
        
        public override void accept (CodeVisitor visitor) {
@@ -76,13 +72,15 @@ public class Vala.SwitchSection : Block {
        }
 
        public override void accept_children (CodeVisitor visitor) {
-               foreach (SwitchLabel label in labels) {
+               labels.foreach ((label) => {
                        label.accept (visitor);
-               }
+                       return true;
+               });
 
-               foreach (Statement st in get_statements ()) {
+               get_statements ().foreach ((st) => {
                        st.accept (visitor);
-               }
+                       return true;
+               });
        }
 
        public override bool check (CodeContext context) {
@@ -92,9 +90,10 @@ public class Vala.SwitchSection : Block {
 
                checked = true;
 
-               foreach (SwitchLabel label in get_labels ()) {
+               get_labels ().foreach ((label) => {
                        label.check (context);
-               }
+                       return true;
+               });
 
                owner = context.analyzer.current_symbol.scope;
 
@@ -103,18 +102,21 @@ public class Vala.SwitchSection : Block {
                context.analyzer.current_symbol = this;
                context.analyzer.insert_block = this;
 
-               foreach (Statement st in get_statements ()) {
+               get_statements ().foreach ((st) => {
                        st.check (context);
-               }
+                       return true;
+               });
 
-               foreach (LocalVariable local in get_local_variables ()) {
+               get_local_variables ().foreach ((local) => {
                        local.active = false;
-               }
+                       return true;
+               });
 
                // use get_statements () instead of statement_list to not miss errors within StatementList 
objects
-               foreach (Statement stmt in get_statements ()) {
+               get_statements ().foreach ((stmt) => {
                        add_error_types (stmt.get_error_types ());
-               }
+                       return true;
+               });
 
                context.analyzer.current_symbol = old_symbol;
                context.analyzer.insert_block = old_insert_block;
@@ -123,9 +125,10 @@ public class Vala.SwitchSection : Block {
        }
 
        public override void emit (CodeGenerator codegen) {
-               foreach (SwitchLabel label in labels) {
+               labels.foreach ((label) => {
                        label.emit (codegen);
-               }
+                       return true;
+               });
 
                base.emit (codegen);
        }
diff --git a/vala/valaswitchstatement.vala b/vala/valaswitchstatement.vala
index 9c382be..f3a3024 100644
--- a/vala/valaswitchstatement.vala
+++ b/vala/valaswitchstatement.vala
@@ -82,9 +82,10 @@ public class Vala.SwitchStatement : CodeNode, Statement {
 
                visitor.visit_end_full_expression (expression);
                
-               foreach (SwitchSection section in sections) {
+               sections.foreach ((section) => {
                        section.accept (visitor);
-               }
+                       return true;
+               });
        }
 
        public override void replace_expression (Expression old_node, Expression new_node) {
@@ -119,11 +120,11 @@ public class Vala.SwitchStatement : CodeNode, Statement {
                expression.target_type.nullable = false;
 
                var labelset = new HashSet<string> ();
-               foreach (SwitchSection section in sections) {
+               sections.foreach ((section) => {
                        section.check (context);
 
                        // check for duplicate literal case labels
-                       foreach (SwitchLabel label in section.get_labels ()) {
+                       section.get_labels ().foreach ((label) => {
                                if (label.expression != null) {
                                        string? value = null;
                                        if (label.expression is StringLiteral) {
@@ -139,9 +140,11 @@ public class Vala.SwitchStatement : CodeNode, Statement {
                                                Report.error (label.expression.source_reference, "Switch 
statement already contains this label");
                                        }
                                }
-                       }
+                               return true;
+                       });
                        add_error_types (section.get_error_types ());
-               }
+                       return true;
+               });
 
                return !error;
        }
diff --git a/vala/valasymbolresolver.vala b/vala/valasymbolresolver.vala
index 32c84e4..c44261d 100644
--- a/vala/valasymbolresolver.vala
+++ b/vala/valasymbolresolver.vala
@@ -352,9 +352,10 @@ public class Vala.SymbolResolver : CodeVisitor {
                }
 
                type.is_dynamic = unresolved_type.is_dynamic;
-               foreach (DataType type_arg in unresolved_type.get_type_arguments ()) {
+               unresolved_type.get_type_arguments ().foreach ((type_arg) => {
                        type.add_type_argument (type_arg);
-               }
+                       return true;
+               });
 
                return type;
        }
diff --git a/vala/valatemplate.vala b/vala/valatemplate.vala
index 5e27a7b..279872b 100644
--- a/vala/valatemplate.vala
+++ b/vala/valatemplate.vala
@@ -33,9 +33,10 @@ public class Vala.Template : Expression {
        }
 
        public override void accept_children (CodeVisitor visitor) {
-               foreach (var expr in expression_list) {
+               expression_list.foreach ((expr) => {
                        expr.accept (visitor);
-               }
+                       return true;
+               });
        }
 
        public void add_expression (Expression expr) {
diff --git a/vala/valatrystatement.vala b/vala/valatrystatement.vala
index 38000f5..59bee71 100644
--- a/vala/valatrystatement.vala
+++ b/vala/valatrystatement.vala
@@ -95,9 +95,10 @@ public class Vala.TryStatement : CodeNode, Statement {
        public override void accept_children (CodeVisitor visitor) {
                body.accept (visitor);
 
-               foreach (CatchClause clause in catch_clauses) {
+               catch_clauses.foreach ((clause) => {
                        clause.accept (visitor);
-               }
+                       return true;
+               });
 
                if (finally_body != null) {
                        finally_body.accept (visitor);
@@ -114,33 +115,39 @@ public class Vala.TryStatement : CodeNode, Statement {
                body.check (context);
 
                var error_types = new ArrayList<DataType> ();
-               foreach (DataType body_error_type in body.get_error_types ()) {
+               body.get_error_types ().foreach ((body_error_type) => {
                        error_types.add (body_error_type);
-               }
+                       return true;
+               });
 
                var handled_error_types = new ArrayList<DataType> ();
-               foreach (CatchClause clause in catch_clauses) {
-                       foreach (DataType body_error_type in error_types) {
+               catch_clauses.foreach ((clause) => {
+                       error_types.foreach ((body_error_type) => {
                                if (clause.error_type == null || body_error_type.compatible 
(clause.error_type)) {
                                        handled_error_types.add (body_error_type);
                                }
-                       }
-                       foreach (DataType handled_error_type in handled_error_types) {
+                               return true;
+                       });
+                       handled_error_types.foreach ((handled_error_type) => {
                                error_types.remove (handled_error_type);
-                       }
+                               return true;
+                       });
                        handled_error_types.clear ();
 
                        clause.check (context);
-                       foreach (DataType body_error_type in clause.body.get_error_types ()) {
+                       clause.body.get_error_types ().foreach ((body_error_type) => {
                                error_types.add (body_error_type);
-                       }
-               }
+                               return true;
+                       });
+                       return true;
+               });
 
                if (finally_body != null) {
                        finally_body.check (context);
-                       foreach (DataType body_error_type in finally_body.get_error_types ()) {
+                       finally_body.get_error_types ().foreach ((body_error_type) => {
                                error_types.add (body_error_type);
-                       }
+                               return true;
+                       });
                }
 
                add_error_types (error_types);
diff --git a/vala/valatuple.vala b/vala/valatuple.vala
index d35795a..4f51c3d 100644
--- a/vala/valatuple.vala
+++ b/vala/valatuple.vala
@@ -33,9 +33,10 @@ public class Vala.Tuple : Expression {
        }
 
        public override void accept_children (CodeVisitor visitor) {
-               foreach (Expression expr in expression_list) {
+               expression_list.foreach ((expr) => {
                        expr.accept (visitor);
-               }
+                       return true;
+               });
        }
 
        public override void accept (CodeVisitor visitor) {
@@ -77,9 +78,10 @@ public class Vala.Tuple : Expression {
        }
 
        public override void emit (CodeGenerator codegen) {
-               foreach (Expression expr in expression_list) {
+               expression_list.foreach ((expr) => {
                        expr.emit (codegen);
-               }
+                       return true;
+               });
 
                codegen.visit_tuple (this);
 
diff --git a/vala/valaunresolvedtype.vala b/vala/valaunresolvedtype.vala
index 527fa0a..9b55fd6 100644
--- a/vala/valaunresolvedtype.vala
+++ b/vala/valaunresolvedtype.vala
@@ -61,9 +61,10 @@ public class Vala.UnresolvedType : DataType {
                        type_ref.value_owned = true;
 
                        var ma = (MemberAccess) expr;
-                       foreach (DataType arg in ma.get_type_arguments ()) {
+                       ma.get_type_arguments ().foreach ((arg) => {
                                type_ref.add_type_argument (arg);
-                       }
+                               return true;
+                       });
 
                        return type_ref;
                }
@@ -79,9 +80,10 @@ public class Vala.UnresolvedType : DataType {
                result.is_dynamic = is_dynamic;
                result.unresolved_symbol = unresolved_symbol.copy ();
                
-               foreach (DataType arg in get_type_arguments ()) {
+               get_type_arguments ().foreach ((arg) => {
                        result.add_type_argument (arg.copy ());
-               }
+                       return true;
+               });
                
                return result;
        }
@@ -93,7 +95,7 @@ public class Vala.UnresolvedType : DataType {
                if (type_args.size > 0) {
                        s += "<";
                        bool first = true;
-                       foreach (DataType type_arg in type_args) {
+                       type_args.foreach ((type_arg) => {
                                if (!first) {
                                        s += ",";
                                } else {
@@ -103,7 +105,8 @@ public class Vala.UnresolvedType : DataType {
                                        s += "weak ";
                                }
                                s += type_arg.to_qualified_string (scope);
-                       }
+                               return true;
+                       });
                        s += ">";
                }
                if (nullable) {


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]