[gnome-calculator/wip/ricotz/gcalc: 10/11] gcalc: Remove superfluous casts in Term



commit 97962d627924cc785e632ea78ed922c534a5663f
Author: Rico Tzschichholz <ricotz ubuntu com>
Date:   Mon Oct 7 20:16:10 2019 +0200

    gcalc: Remove superfluous casts in Term

 gcalc/gcalc-term.vala | 10 +++++-----
 1 file changed, 5 insertions(+), 5 deletions(-)
---
diff --git a/gcalc/gcalc-term.vala b/gcalc/gcalc-term.vala
index 21a60d65..76ebf6db 100644
--- a/gcalc/gcalc-term.vala
+++ b/gcalc/gcalc-term.vala
@@ -77,7 +77,7 @@ public interface GCalc.Term : Object, Expression {
           }
         }
       } else if (e is Variable) {
-        var ev = (e as Variable).evaluate ();
+        var ev = ((Variable) e).evaluate ();
         if (current == null) {
           current = ev;
           first = false;
@@ -98,16 +98,16 @@ public interface GCalc.Term : Object, Expression {
   {
     Expression res = null;
     if (op is Minus) {
-      res = (c1 as Constant).multiply (c2 as Constant);
+      res = c1.multiply (c2);
     }
     if (op is Multiply) {
-      res = (c1 as Constant).multiply (c2 as Constant);
+      res = c1.multiply (c2);
     }
     if (op is Division) {
-      res = (c1 as Constant).divide (c2 as Constant);
+      res = c1.divide (c2);
     }
     if (op is Pow) {
-      res = (c1 as Constant).pow (c2 as Constant);
+      res = c1.pow (c2);
     }
     if (res == null) {
       throw new TermError.INVALID_OPERATOR ("Unsupported operator in term's expression");


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]