]> git.ipfire.org Git - thirdparty/vala.git/commitdiff
vala: Add UnaryOperator.to_string()
authorRico Tzschichholz <ricotz@ubuntu.com>
Thu, 15 Nov 2018 16:26:19 +0000 (17:26 +0100)
committerRico Tzschichholz <ricotz@ubuntu.com>
Thu, 15 Nov 2018 16:28:08 +0000 (17:28 +0100)
vala/valaunaryexpression.vala

index 7ccbecb1d00e3bbec8d7ff558e1d27e580c3aa45..ce5e4a062ef27dfac36d2e0d5718edcd0e20147f 100644 (file)
@@ -77,22 +77,8 @@ public class Vala.UnaryExpression : Expression {
                }
        }
 
-       private unowned string get_operator_string () {
-               switch (_operator) {
-               case UnaryOperator.PLUS: return "+";
-               case UnaryOperator.MINUS: return "-";
-               case UnaryOperator.LOGICAL_NEGATION: return "!";
-               case UnaryOperator.BITWISE_COMPLEMENT: return "~";
-               case UnaryOperator.INCREMENT: return "++";
-               case UnaryOperator.DECREMENT: return "--";
-               case UnaryOperator.REF: return "ref ";
-               case UnaryOperator.OUT: return "out ";
-               default: assert_not_reached ();
-               }
-       }
-
        public override string to_string () {
-               return get_operator_string () + _inner.to_string ();
+               return operator.to_string () + _inner.to_string ();
        }
 
        public override bool is_constant () {
@@ -291,5 +277,20 @@ public enum Vala.UnaryOperator {
        INCREMENT,
        DECREMENT,
        REF,
-       OUT
+       OUT;
+
+       public unowned string to_string () {
+               switch (this) {
+               case PLUS: return "+";
+               case MINUS: return "-";
+               case LOGICAL_NEGATION: return "!";
+               case BITWISE_COMPLEMENT: return "~";
+               case INCREMENT: return "++";
+               case DECREMENT: return "--";
+               case REF: return "ref ";
+               case OUT: return "out ";
+               default: assert_not_reached ();
+               }
+       }
+
 }