[gnome-calculator] equation: use vala smart strings to generate error code strings



commit df449460314ffcac7a2f8968291e89667b1eab8c
Author: Marco Trevisan (TreviƱo) <mail 3v1n0 net>
Date:   Sat Aug 25 04:44:39 2018 +0200

    equation: use vala smart strings to generate error code strings
    
    Just a cleanup, so this list has not to be maintened anymore.

 lib/equation.vala | 20 +-------------------
 1 file changed, 1 insertion(+), 19 deletions(-)
---
diff --git a/lib/equation.vala b/lib/equation.vala
index ad19b872..d5ab0f3d 100644
--- a/lib/equation.vala
+++ b/lib/equation.vala
@@ -70,25 +70,7 @@ public int super_atoi (string data)
 
 public string mp_error_code_to_string (ErrorCode error_code)
 {
-    switch (error_code)
-    {
-    case ErrorCode.NONE:
-        return "ErrorCode.NONE";
-    case ErrorCode.INVALID:
-        return "ErrorCode.INVALID";
-    case ErrorCode.OVERFLOW:
-        return "ErrorCode.OVERFLOW";
-    case ErrorCode.UNKNOWN_VARIABLE:
-        return "ErrorCode.UNKNOWN_VARIABLE";
-    case ErrorCode.UNKNOWN_FUNCTION:
-        return "ErrorCode.UNKNOWN_FUNCTION";
-    case ErrorCode.UNKNOWN_CONVERSION:
-        return "ErrorCode.UNKNOWN_CONVERSION";
-    case ErrorCode.MP:
-        return "ErrorCode.MP";
-    default:
-        return "Unknown parser error";
-    }
+    return @"$error_code".replace ("ERROR_CODE_", "ErrorCode.");
 }
 
 public enum ErrorCode


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