[vala/switch-to-gir: 6/34] Support adding new source files while visiting the code tree.
- From: Luca Bruno <lucabru src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [vala/switch-to-gir: 6/34] Support adding new source files while visiting the code tree.
- Date: Sun, 29 Aug 2010 22:23:21 +0000 (UTC)
commit c9a7f4de79459ce189f4cf4124c70d5b23d3e4d2
Author: Luca Bruno <lethalman88 gmail com>
Date: Mon Aug 23 20:51:48 2010 +0200
Support adding new source files while visiting the code tree.
vala/valacodecontext.vala | 9 +++++++--
1 files changed, 7 insertions(+), 2 deletions(-)
---
diff --git a/vala/valacodecontext.vala b/vala/valacodecontext.vala
index 9210f28..a27c2ff 100644
--- a/vala/valacodecontext.vala
+++ b/vala/valacodecontext.vala
@@ -431,14 +431,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++;
}
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]