[vala] Report error on invalid initializer expression
- From: Jürg Billeter <juergbi src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [vala] Report error on invalid initializer expression
- Date: Sun, 19 Dec 2010 13:54:12 +0000 (UTC)
commit 84bf66df30f5904fe38b64936a678f59ce505e05
Author: Luca Bruno <lucabru src gnome org>
Date: Sun Dec 19 10:46:22 2010 +0100
Report error on invalid initializer expression
Fixes bug 637521.
vala/valaarraycreationexpression.vala | 4 +++-
vala/valaassignment.vala | 2 +-
vala/valainitializerlist.vala | 1 +
3 files changed, 5 insertions(+), 2 deletions(-)
---
diff --git a/vala/valaarraycreationexpression.vala b/vala/valaarraycreationexpression.vala
index 1c72d6b..3b52748 100644
--- a/vala/valaarraycreationexpression.vala
+++ b/vala/valaarraycreationexpression.vala
@@ -190,7 +190,9 @@ public class Vala.ArrayCreationExpression : Expression {
if (initlist != null) {
initlist.target_type = new ArrayType (element_type, rank, source_reference);
- initlist.check (context);
+ if (!initlist.check (context)) {
+ error = true;
+ }
var ret = create_sizes_from_initializer_list (context, initlist, rank, calc_sizes);
if (ret == -1) {
diff --git a/vala/valaassignment.vala b/vala/valaassignment.vala
index f0b4742..f959060 100644
--- a/vala/valaassignment.vala
+++ b/vala/valaassignment.vala
@@ -341,7 +341,7 @@ public class Vala.Assignment : Expression {
right.value_type = variable.variable_type;
} else {
error = true;
- Report.error (source_reference, "Assignment: Invalid callback assignment attempt");
+ Report.error (source_reference, "Assignment: Invalid assignment attempt");
return false;
}
}
diff --git a/vala/valainitializerlist.vala b/vala/valainitializerlist.vala
index 5ed9ba8..a6208ce 100644
--- a/vala/valainitializerlist.vala
+++ b/vala/valainitializerlist.vala
@@ -178,6 +178,7 @@ public class Vala.InitializerList : Expression {
foreach (Expression e in get_initializers ()) {
if (e.value_type == null) {
error = true;
+ Report.error (e.source_reference, "expression type not allowed as initializer");
continue;
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]