#REFACTORING by exept draft
authorClaus Gittinger <cg@exept.de>
Sun, 08 Sep 2019 17:31:10 +0200
changeset 3763 c3c9e58661a6
parent 3762 4d688d979769
child 3764 e140f846dccf
#REFACTORING by exept class: MethodFinderWindow changed: #mergeReceiver:withArgument:
MethodFinderWindow.st
--- a/MethodFinderWindow.st	Sun Sep 08 17:02:41 2019 +0200
+++ b/MethodFinderWindow.st	Sun Sep 08 17:31:10 2019 +0200
@@ -1655,42 +1655,28 @@
 
 mergeReceiver: aReceiver withArgument: arguments
 
-"Puts the receiver and arguments into an array so it can be of a suitable input for the
- MethodFinder. Return an array."
+    "Puts the receiver and arguments into an array so it can be of a suitable input for the
+     MethodFinder. Return an array."
 
-| tempReceiver tempArguments receiverWithArgument|
+    | tempReceiver tempArguments nTempArgs |
 
-  tempReceiver:= aReceiver.
- tempArguments :=  arguments.
+    tempReceiver:= aReceiver.
+    tempArguments := arguments.
+    nTempArgs := tempArguments size.
 
-(tempArguments isEmpty or:[(tempArguments) isNil])
-                ifTrue:[  receiverWithArgument:=Array new:1."no argument"
-                          receiverWithArgument at:1 put: tempReceiver.     
-                        ]
-                ifFalse:[
-        (tempArguments size == 1)
-                        ifTrue:[ receiverWithArgument:=Array new:2.
-                                  receiverWithArgument at:1 put: tempReceiver.      
-                                  receiverWithArgument at:2 put: (tempArguments at:1)
-                                ].  "a receiver with an argument"
-
-        (tempArguments size = 2)
-                        ifTrue:[ receiverWithArgument:=Array new:3.
-                                  receiverWithArgument at:1 put: tempReceiver.      
-                                  (receiverWithArgument at:2 put: (tempArguments at:1)).
-                                  (receiverWithArgument at:3 put: (tempArguments at:2))
-                                ].  "a receiver with an argument"
-        (tempArguments size = 3)
-                        ifTrue:[ receiverWithArgument:=Array new:4.
-                                  receiverWithArgument at:1 put: tempReceiver.      
-                                  (receiverWithArgument at:2 put: (tempArguments at:1)).
-                                  (receiverWithArgument at:3 put: (tempArguments at:2)).
-                                  (receiverWithArgument at:4 put: (tempArguments at:3)).
-
-                                ].  "a receiver with an argument"
-
-                        ].
-^receiverWithArgument
+    nTempArgs == 0 ifTrue:[  
+        ^ { tempReceiver }
+    ].
+    (nTempArgs == 1) ifTrue:[ 
+        ^ { tempReceiver . (tempArguments at:1) }  "a receiver with an argument"
+    ].
+    (nTempArgs == 2) ifTrue:[  
+        ^ { tempReceiver . (tempArguments at:1) . (tempArguments at:2) }  "a receiver with 2 arguments"
+    ].
+    (nTempArgs == 3) ifTrue:[ 
+        ^ { tempReceiver .  (tempArguments at:1) . (tempArguments at:2) . (tempArguments at:3) } " 3 args"
+    ].
+    ^ nil
 ! !
 
 !MethodFinderWindow methodsFor:'initialization'!