diff options
author | Juerg Billeter <j@bitron.ch> | 2008-02-29 21:41:44 +0000 |
---|---|---|
committer | Jürg Billeter <juergbi@src.gnome.org> | 2008-02-29 21:41:44 +0000 |
commit | 266addfc71f16da4f754b0d988e6b054c6bf0731 (patch) | |
tree | 5891c727fdd05ce76f796991f6d47a6e9754e613 /vala/valabinaryexpression.vala | |
parent | b5633efd891b51e1a86aef6c7ab227586a76dbdf (diff) | |
download | vala-266addfc71f16da4f754b0d988e6b054c6bf0731.tar.gz |
support binary expressions in default arguments
2008-02-29 Juerg Billeter <j@bitron.ch>
* vala/valabinaryexpression.vala, vala/valaunaryexpression.vala:
support binary expressions in default arguments
svn path=/trunk/; revision=1067
Diffstat (limited to 'vala/valabinaryexpression.vala')
-rw-r--r-- | vala/valabinaryexpression.vala | 32 |
1 files changed, 31 insertions, 1 deletions
diff --git a/vala/valabinaryexpression.vala b/vala/valabinaryexpression.vala index 7a7665dc9..e60acc442 100644 --- a/vala/valabinaryexpression.vala +++ b/vala/valabinaryexpression.vala @@ -1,6 +1,6 @@ /* valabinaryexpression.vala * - * Copyright (C) 2006-2007 Jürg Billeter + * Copyright (C) 2006-2008 Jürg Billeter * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public @@ -94,6 +94,36 @@ public class Vala.BinaryExpression : Expression { } } + private string! get_operator_string () { + switch (_operator) { + case BinaryOperator.PLUS: return "+"; + case BinaryOperator.MINUS: return "-"; + case BinaryOperator.MUL: return "*"; + case BinaryOperator.DIV: return "/"; + case BinaryOperator.MOD: return "%"; + case BinaryOperator.SHIFT_LEFT: return "<<"; + case BinaryOperator.SHIFT_RIGHT: return ">>"; + case BinaryOperator.LESS_THAN: return "<"; + case BinaryOperator.GREATER_THAN: return ">"; + case BinaryOperator.LESS_THAN_OR_EQUAL: return "<="; + case BinaryOperator.GREATER_THAN_OR_EQUAL: return ">="; + case BinaryOperator.EQUALITY: return "=="; + case BinaryOperator.INEQUALITY: return "!+"; + case BinaryOperator.BITWISE_AND: return "&"; + case BinaryOperator.BITWISE_OR: return "|"; + case BinaryOperator.BITWISE_XOR: return "^"; + case BinaryOperator.AND: return "&&"; + case BinaryOperator.OR: return "||"; + case BinaryOperator.IN: return "in"; + } + + assert_not_reached (); + } + + public override string! to_string () { + return _left.to_string () + get_operator_string () + _right.to_string (); + } + public override bool is_pure () { return left.is_pure () && right.is_pure (); } |