[vala] girparser: Allow specifying default value to Metadata.get_bool
- From: Luca Bruno <lucabru src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [vala] girparser: Allow specifying default value to Metadata.get_bool
- Date: Sat, 16 Jul 2011 17:13:32 +0000 (UTC)
commit 8b6977498027b3c9c76f051ebdaac0fbbca8b2f4
Author: Luca Bruno <lucabru src gnome org>
Date: Sat Jul 16 18:39:58 2011 +0200
girparser: Allow specifying default value to Metadata.get_bool
vala/valagirparser.vala | 8 +++-----
1 files changed, 3 insertions(+), 5 deletions(-)
---
diff --git a/vala/valagirparser.vala b/vala/valagirparser.vala
index 2d11096..335a203 100644
--- a/vala/valagirparser.vala
+++ b/vala/valagirparser.vala
@@ -204,12 +204,12 @@ public class Vala.GirParser : CodeVisitor {
return 0;
}
- public bool get_bool (ArgumentType arg) {
+ public bool get_bool (ArgumentType arg, bool default_value = false) {
var lit = get_expression (arg) as BooleanLiteral;
if (lit != null) {
return lit.value;
}
- return false;
+ return default_value;
}
public SourceReference? get_source_reference (ArgumentType arg) {
@@ -1400,9 +1400,7 @@ public class Vala.GirParser : CodeVisitor {
type.value_owned = metadata.get_bool (ArgumentType.OWNED);
}
}
- if (metadata.has_argument (ArgumentType.NULLABLE)) {
- type.nullable = metadata.get_bool (ArgumentType.NULLABLE);
- }
+ type.nullable = metadata.get_bool (ArgumentType.NULLABLE, type.nullable);
}
if (type is ArrayType && !(orig_type is ArrayType)) {
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]