[vala/wip/baedert/nullable: 10/25] binaryexpression: Fix is_non_null for COALESCE expressions
- From: Timm Bäder <baedert src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [vala/wip/baedert/nullable: 10/25] binaryexpression: Fix is_non_null for COALESCE expressions
- Date: Tue, 8 Nov 2016 21:18:53 +0000 (UTC)
commit 0bdd1975970949a55187f1527f93e5b1bce24fdc
Author: Timm Bäder <mail baedert org>
Date: Sat Nov 5 21:48:58 2016 +0100
binaryexpression: Fix is_non_null for COALESCE expressions
vala/valabinaryexpression.vala | 4 ++++
1 files changed, 4 insertions(+), 0 deletions(-)
---
diff --git a/vala/valabinaryexpression.vala b/vala/valabinaryexpression.vala
index b081090..7e08f64 100644
--- a/vala/valabinaryexpression.vala
+++ b/vala/valabinaryexpression.vala
@@ -138,6 +138,10 @@ public class Vala.BinaryExpression : Expression {
}
public override bool is_non_null () {
+ if (operator == BinaryOperator.COALESCE) {
+ // The coalesce operator makes sure that `right` is taken if left is null
+ return right.is_non_null ();
+ }
return left.is_non_null () && right.is_non_null ();
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]