]> git.ipfire.org Git - thirdparty/vala.git/commitdiff
Support adding new source files while visiting the code tree
authorLuca Bruno <lethalman88@gmail.com>
Mon, 23 Aug 2010 18:51:48 +0000 (20:51 +0200)
committerJürg Billeter <j@bitron.ch>
Sun, 3 Oct 2010 20:17:39 +0000 (22:17 +0200)
vala/valacodecontext.vala

index 8525fff5ab22f664ff5bb8c5b69d0e79c43efc4b..988a864f991f550c94d535673f193530b53f8b59 100644 (file)
@@ -428,14 +428,19 @@ public class Vala.CodeContext {
 
        /**
         * Visits the complete code tree file by file.
+        * It is possible to add new source files while visiting the tree.
         *
         * @param visitor the visitor to be called when traversing
         */
        public void accept (CodeVisitor visitor) {
                root.accept (visitor);
 
-               foreach (SourceFile file in source_files) {
-                       file.accept (visitor);
+               // support queueing new source files
+               int index = 0;
+               while (index < source_files.size) {
+                       var source_file = source_files[index];
+                       source_file.accept (visitor);
+                       index++;
                }
        }