]> git.ipfire.org Git - thirdparty/vala.git/commitdiff
binaryexpression: Fix is_non_null for COALESCE expressions
authorTimm Bäder <mail@baedert.org>
Sat, 5 Nov 2016 20:48:58 +0000 (21:48 +0100)
committerTimm Bäder <mail@baedert.org>
Sat, 5 Nov 2016 20:48:58 +0000 (21:48 +0100)
vala/valabinaryexpression.vala

index b081090d0305a841f39e0ac6a078862eb9e4304c..7e08f64a491475d3a9cddbaf79b757fc5692dfd9 100644 (file)
@@ -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 ();
        }