Vala Devs, I originally attached this patch to: https://bugzilla.gnome.org/show_bug.cgi?id=620133
Upon further review though I'm not really sure if the patch and the bug report are related. Given that, I've decided to re-post the patch here. I think it's still worth committing even if it doesn't solve the aforementioned bug. Steven N. Oliver
From f7dd5161bc35306b2ff8ad12e4d8a5e16f32c773 Mon Sep 17 00:00:00 2001 From: Steven Oliver <oliver.ste...@gmail.com> Date: Mon, 9 Sep 2013 17:17:22 -0400 Subject: [PATCH] [Genie] Add coalescing function --- vala/valagenieparser.vala | 11 +++++++++++ vala/valagenietokentype.vala | 1 + 2 files changed, 12 insertions(+) diff --git a/vala/valagenieparser.vala b/vala/valagenieparser.vala index f479905..ad84415 100644 --- a/vala/valagenieparser.vala +++ b/vala/valagenieparser.vala @@ -1520,6 +1520,17 @@ public class Vala.Genie.Parser : CodeVisitor { return left; } + Expression parse_coalescing_expression () throws ParseError { + var begin = get_location (); + var left = parse_conditional_or_expression (); + if (accept (TokenType.OP_COALESCING)) { + var right = parse_coalescing_expression (); + return new BinaryExpression (BinaryOperator.COALESCE, left, right, get_src (begin)); + } else { + return left; + } + } + Expression parse_conditional_or_expression () throws ParseError { var begin = get_location (); var left = parse_conditional_and_expression (); diff --git a/vala/valagenietokentype.vala b/vala/valagenietokentype.vala index 920a96a..df78e22 100644 --- a/vala/valagenietokentype.vala +++ b/vala/valagenietokentype.vala @@ -107,6 +107,7 @@ public enum Vala.Genie.TokenType { OF, OUT, OP_AND, + OP_COALESCING, OP_DEC, OP_EQ, OP_GE, -- 1.8.3.1
_______________________________________________ vala-list mailing list vala-list@gnome.org https://mail.gnome.org/mailman/listinfo/vala-list