[vala] Only allow null default value for out parameters
- From: Jürg Billeter <juergbi src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [vala] Only allow null default value for out parameters
- Date: Thu, 23 Dec 2010 10:40:57 +0000 (UTC)
commit 645b7ce16d84055601f5a519f2ca538029299fff
Author: Luca Bruno <lucabru src gnome org>
Date: Mon Dec 20 13:17:00 2010 +0100
Only allow null default value for out parameters
Fixes bug 636096.
vala/valaparameter.vala | 2 ++
1 files changed, 2 insertions(+), 0 deletions(-)
---
diff --git a/vala/valaparameter.vala b/vala/valaparameter.vala
index d73e25c..aea16ef 100644
--- a/vala/valaparameter.vala
+++ b/vala/valaparameter.vala
@@ -262,6 +262,8 @@ public class Vala.Parameter : Variable {
&& !variable_type.nullable
&& direction != ParameterDirection.OUT) {
Report.warning (source_reference, "`null' incompatible with parameter type `%s`".printf (variable_type.to_string ()));
+ } else if (!(initializer is NullLiteral) && direction == ParameterDirection.OUT) {
+ Report.error (source_reference, "only `null' is allowed as default value for out parameters");
}
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]