]> git.ipfire.org Git - thirdparty/vala.git/commitdiff
vapigen: Support shared finish methods
authorMichal Hruby <michal.mhr@gmail.com>
Wed, 21 Jul 2010 15:25:03 +0000 (17:25 +0200)
committerJürg Billeter <j@bitron.ch>
Wed, 21 Jul 2010 15:25:03 +0000 (17:25 +0200)
vapigen/valagidlparser.vala

index 3bbf6bae487fb3ee9558c2f94a16e397b37febe1..a932ef23beb69da23507aa8590928bf7e38d4153 100644 (file)
@@ -1332,10 +1332,10 @@ public class Vala.GIdlParser : CodeVisitor {
        }
 
        void handle_async_methods (ObjectTypeSymbol type_symbol) {
+               Set<Method> finish_methods = new HashSet<Method> ();
                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) {