diff options
Diffstat (limited to 'ccode')
-rw-r--r-- | ccode/valaccodeblock.vala | 13 | ||||
-rw-r--r-- | ccode/valaccodecommaexpression.vala | 5 | ||||
-rw-r--r-- | ccode/valaccodedeclaration.vala | 26 | ||||
-rw-r--r-- | ccode/valaccodeenum.vala | 5 | ||||
-rw-r--r-- | ccode/valaccodeexpressionstatement.vala | 5 | ||||
-rw-r--r-- | ccode/valaccodefile.vala | 5 | ||||
-rw-r--r-- | ccode/valaccodeforstatement.vala | 10 | ||||
-rw-r--r-- | ccode/valaccodefragment.vala | 15 | ||||
-rw-r--r-- | ccode/valaccodefunction.vala | 10 | ||||
-rw-r--r-- | ccode/valaccodefunctioncall.vala | 5 | ||||
-rw-r--r-- | ccode/valaccodefunctiondeclarator.vala | 5 | ||||
-rw-r--r-- | ccode/valaccodeinitializerlist.vala | 5 | ||||
-rw-r--r-- | ccode/valaccodeoncesection.vala | 5 | ||||
-rw-r--r-- | ccode/valaccodestruct.vala | 5 |
14 files changed, 67 insertions, 52 deletions
diff --git a/ccode/valaccodeblock.vala b/ccode/valaccodeblock.vala index 5c8f2c74d..c642e6b42 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 6010428e0..643c14c45 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 4cbd86204..9dbcc840e 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; + }); writer.write_string (";"); writer.write_newline (); @@ -112,14 +111,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 f2a378879..4fba47e81 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 57b2b2da4..fa2e855b3 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 0b256e518..a191ef330 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 c4d14be95..9d7796b61 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 0e229fffa..3d2d792d6 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 08d3876fb..5c2b2267a 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 e9e7d14c3..76906ff32 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 30f0c63b1..256da8045 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 26cb56e1d..a26603ba1 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 10aa861cc..8223bcb8a 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 fce7fcba8..3da5aa231 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) { |