DoWhatIMeanSupport.st
changeset 5058 925bc542ebd1
parent 5052 4df885d2b30f
child 5064 6a358957f3fd
--- a/DoWhatIMeanSupport.st	Wed May 04 18:54:24 2016 +0200
+++ b/DoWhatIMeanSupport.st	Wed May 04 18:55:02 2016 +0200
@@ -2153,7 +2153,7 @@
     "find good completions for a message selector in a message-send node"
     
     |selector lcSelector srchClass implClass    
-     bestSelectors selector2 bestSelectors2 bestWithParenthesis allBest best info numArgs
+     bestSelectors parentSelector newParentSelector bestSelectors2 bestWithParenthesis allBest best info numArgs
      newParts nSelParts oldLen newLen selectorParts
      findBest parentNode nodeReceiver "selectorsSentInCode" selectorsImplementedInClass
      editAction parentNodeClassIfKnown
@@ -2363,17 +2363,17 @@
 "/    bestSelectors sort:[:a :b | a size < b size].
  
     (selector isUnarySelector and:[ parentNode notNil and:[ parentNode isMessage ]]) ifTrue:[
-        (selector2 := parentNode selector) isKeyword ifTrue:[
+        (parentSelector := parentNode selector) isKeyword ifTrue:[
             "/ if its a unary message AND the parent is a keyword node, look for parent completion too.
             "/ i.e. look if there is a longer keyword possible
-            selector2 := selector2,selector.
-            bestSelectors2 := findBest value:(parentNode receiver) value:selector2.
-            bestSelectors2 := bestSelectors2 select:[:sel | sel isKeyword and:[ sel startsWith:selector2]].
+            newParentSelector := parentSelector,selector.
+            bestSelectors2 := findBest value:(parentNode receiver) value:newParentSelector.
+            bestSelectors2 := bestSelectors2 select:[:sel | sel isKeyword and:[ sel startsWith:parentSelector]].
             bestSelectors2 := bestSelectors2 asOrderedCollection sort:[:a :b | a size < b size].
             bestSelectors := bestSelectors reject:[:sel | bestSelectors2 includes:sel].
  
             "/ if the parent has a valid selector, offer parenthization
-            (Smalltalk someImplementorOf:selector2) notNil ifTrue:[
+            (Smalltalk someImplementorOf:parentSelector) notNil ifTrue:[
                 offerParenthisationAroundNode := parentNode.
                 "/ Transcript show:'2:'; showCR:parentNode.
             ].
@@ -2524,12 +2524,12 @@
     self sortSelectors:allBest forSelector:selector lcSelector:lcSelector.
                         
     "/ sort: prefixes first.
-    selector2 notNil ifTrue:[
+    parentSelector notNil ifTrue:[
         allBest := self 
                     splitSelectorList:allBest 
                     by:[:sel | 
                             (sel asLowercase startsWith:lcSelector) 
-                            or:[sel startsWith:selector2]].
+                            or:[sel startsWith:parentSelector]].
     ].
  
     "/ if receiver is super, always include the method's own selector