Compress duplicate cases in type switch.

Project: http://git-wip-us.apache.org/repos/asf/lucy-clownfish/repo
Commit: http://git-wip-us.apache.org/repos/asf/lucy-clownfish/commit/699a22b5
Tree: http://git-wip-us.apache.org/repos/asf/lucy-clownfish/tree/699a22b5
Diff: http://git-wip-us.apache.org/repos/asf/lucy-clownfish/diff/699a22b5

Branch: refs/heads/master
Commit: 699a22b58c26729eb8bcea2c8c2d625fc8f9ba0c
Parents: 029d978
Author: Marvin Humphrey <[email protected]>
Authored: Wed Aug 19 19:10:00 2015 -0700
Committer: Marvin Humphrey <[email protected]>
Committed: Fri Sep 4 14:26:58 2015 -0700

----------------------------------------------------------------------
 runtime/go/clownfish/clownfish.go | 48 ++--------------------------------
 1 file changed, 2 insertions(+), 46 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/lucy-clownfish/blob/699a22b5/runtime/go/clownfish/clownfish.go
----------------------------------------------------------------------
diff --git a/runtime/go/clownfish/clownfish.go 
b/runtime/go/clownfish/clownfish.go
index 5fd7c64..b5a9401 100644
--- a/runtime/go/clownfish/clownfish.go
+++ b/runtime/go/clownfish/clownfish.go
@@ -274,55 +274,11 @@ func GoToClownfish(value interface{}, class 
unsafe.Pointer, nullable bool) unsaf
                if klass == C.CFISH_BLOB || klass == C.CFISH_OBJ {
                        converted = goToBlob(value)
                }
-       case int:
-               if klass == C.CFISH_INTEGER || klass == C.CFISH_OBJ {
-                       converted = goToInteger(value)
-               }
-       case uint:
-               if klass == C.CFISH_INTEGER || klass == C.CFISH_OBJ {
-                       converted = goToInteger(value)
-               }
-       case uintptr:
-               if klass == C.CFISH_INTEGER || klass == C.CFISH_OBJ {
-                       converted = goToInteger(value)
-               }
-       case int64:
-               if klass == C.CFISH_INTEGER || klass == C.CFISH_OBJ {
-                       converted = goToInteger(value)
-               }
-       case int32:
-               if klass == C.CFISH_INTEGER || klass == C.CFISH_OBJ {
-                       converted = goToInteger(value)
-               }
-       case int16:
-               if klass == C.CFISH_INTEGER || klass == C.CFISH_OBJ {
-                       converted = goToInteger(value)
-               }
-       case int8:
-               if klass == C.CFISH_INTEGER || klass == C.CFISH_OBJ {
-                       converted = goToInteger(value)
-               }
-       case uint64:
+       case int, uint, uintptr, int64, int32, int16, int8, uint64, uint32, 
uint16, uint8:
                if klass == C.CFISH_INTEGER || klass == C.CFISH_OBJ {
                        converted = goToInteger(value)
                }
-       case uint32:
-               if klass == C.CFISH_INTEGER || klass == C.CFISH_OBJ {
-                       converted = goToInteger(value)
-               }
-       case uint16:
-               if klass == C.CFISH_INTEGER || klass == C.CFISH_OBJ {
-                       converted = goToInteger(value)
-               }
-       case uint8:
-               if klass == C.CFISH_INTEGER || klass == C.CFISH_OBJ {
-                       converted = goToInteger(value)
-               }
-       case float32:
-               if klass == C.CFISH_FLOAT || klass == C.CFISH_OBJ {
-                       converted = goToFloat(value)
-               }
-       case float64:
+       case float32, float64:
                if klass == C.CFISH_FLOAT || klass == C.CFISH_OBJ {
                        converted = goToFloat(value)
                }

Reply via email to