From: Michal Hruby Date: Wed, 21 Jul 2010 15:25:03 +0000 (+0200) Subject: vapigen: Support shared finish methods X-Git-Tag: 0.9.4~22 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=19ac64d0c3ef3ef304d1650ceaa35312073b15a6;p=thirdparty%2Fvala.git vapigen: Support shared finish methods --- diff --git a/vapigen/valagidlparser.vala b/vapigen/valagidlparser.vala index 3bbf6bae4..a932ef23b 100644 --- a/vapigen/valagidlparser.vala +++ b/vapigen/valagidlparser.vala @@ -1332,10 +1332,10 @@ public class Vala.GIdlParser : CodeVisitor { } void handle_async_methods (ObjectTypeSymbol type_symbol) { + Set finish_methods = new HashSet (); var methods = type_symbol.get_methods (); - for (int method_n = 0 ; method_n < methods.size ; method_n++) { - var m = methods.get (method_n); + foreach (Method m in methods) { if (m.coroutine) { string finish_method_base; if (m.name.has_suffix ("_async")) { @@ -1373,14 +1373,16 @@ public class Vala.GIdlParser : CodeVisitor { foreach (DataType error_type in finish_method.get_error_types ()) { m.add_error_type (error_type.copy ()); } - if (methods.index_of (finish_method) < method_n) { - method_n--; - } - type_symbol.scope.remove (finish_method.name); - methods.remove (finish_method); + finish_methods.add (finish_method); } } } + + foreach (Method m in finish_methods) + { + type_symbol.scope.remove (m.name); + methods.remove (m); + } } private DataType? parse_type (IdlNodeType type_node, out ParameterDirection direction = null) {