[vala] Report error when initializing constants or fields in bindings
- From: Jürg Billeter <juergbi src gnome org>
- To: svn-commits-list gnome org
- Subject: [vala] Report error when initializing constants or fields in bindings
- Date: Mon, 27 Jul 2009 17:31:18 +0000 (UTC)
commit 2685caf7e0ee6bba8bbe0643d993a08fab37395f
Author: Jürg Billeter <j bitron ch>
Date: Mon Jul 27 19:30:41 2009 +0200
Report error when initializing constants or fields in bindings
Fixes bug 556197.
vala/valaconstant.vala | 5 +++++
vala/valafield.vala | 5 +++++
2 files changed, 10 insertions(+), 0 deletions(-)
---
diff --git a/vala/valaconstant.vala b/vala/valaconstant.vala
index 1aa299a..54722c3 100644
--- a/vala/valaconstant.vala
+++ b/vala/valaconstant.vala
@@ -191,6 +191,11 @@ public class Vala.Constant : Member, Lockable {
return false;
}
}
+ } else {
+ if (initializer != null) {
+ error = true;
+ Report.error (source_reference, "External constants cannot use initializers");
+ }
}
if (!external_package && !hides && get_hidden_member () != null) {
diff --git a/vala/valafield.vala b/vala/valafield.vala
index 420f7f9..43336a8 100644
--- a/vala/valafield.vala
+++ b/vala/valafield.vala
@@ -319,6 +319,11 @@ public class Vala.Field : Member, Lockable {
Report.error (source_reference, "Cannot convert from `%s' to `%s'".printf (initializer.value_type.to_string (), field_type.to_string ()));
return false;
}
+
+ if (external) {
+ error = true;
+ Report.error (source_reference, "External fields cannot use initializers");
+ }
}
if (binding == MemberBinding.INSTANCE && parent_symbol is Interface) {
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]