[vala] dova: Fix crash on replaced expressions in list and set literals
- From: Jürg Billeter <juergbi src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [vala] dova: Fix crash on replaced expressions in list and set literals
- Date: Sun, 3 Oct 2010 17:28:08 +0000 (UTC)
commit eaeb0169c991fa720f7a07fd8c8dac7f087e7ac8
Author: Jürg Billeter <j bitron ch>
Date: Thu Sep 30 21:27:50 2010 +0200
dova: Fix crash on replaced expressions in list and set literals
vala/valalistliteral.vala | 8 +++++++-
vala/valasetliteral.vala | 8 +++++++-
2 files changed, 14 insertions(+), 2 deletions(-)
---
diff --git a/vala/valalistliteral.vala b/vala/valalistliteral.vala
index f816550..e3c6d6d 100644
--- a/vala/valalistliteral.vala
+++ b/vala/valalistliteral.vala
@@ -95,13 +95,19 @@ public class Vala.ListLiteral : Literal {
fixed_element_type = true;
}
- foreach (var expr in expression_list) {
+ for (int i = 0; i < expression_list.size; i++) {
+ var expr = expression_list[i];
+
if (fixed_element_type) {
expr.target_type = element_type;
}
if (!expr.check (analyzer)) {
return false;
}
+
+ // expression might have been replaced in the list
+ expr = expression_list[i];
+
if (element_type == null) {
element_type = expr.value_type.copy ();
element_type.value_owned = false;
diff --git a/vala/valasetliteral.vala b/vala/valasetliteral.vala
index 42be178..5ae8e94 100644
--- a/vala/valasetliteral.vala
+++ b/vala/valasetliteral.vala
@@ -79,13 +79,19 @@ public class Vala.SetLiteral : Literal {
fixed_element_type = true;
}
- foreach (var expr in expression_list) {
+ for (int i = 0; i < expression_list.size; i++) {
+ var expr = expression_list[i];
+
if (fixed_element_type) {
expr.target_type = element_type;
}
if (!expr.check (analyzer)) {
return false;
}
+
+ // expression might have been replaced in the list
+ expr = expression_list[i];
+
if (element_type == null) {
element_type = expr.value_type.copy ();
element_type.value_owned = false;
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]