#FEATURE by exept
class: MethodFinder
changed:
#findMessage
#initialize
#simpleSearch
#testPerfect:
--- a/MethodFinder.st Mon Jul 22 17:39:24 2019 +0200
+++ b/MethodFinder.st Sun Jul 28 01:08:19 2019 +0200
@@ -1,5 +1,3 @@
-"{ Encoding: utf8 }"
-
"
Copyright (C) Original Authors (Kaehler, Scott Wallace and Dan Ingalls)
Copyright (C) 2001 eXept Software AG
@@ -843,7 +841,12 @@
"removing"
"copying"
- , copyAfterLast: #'copyAt:put:' #'copyFrom:to:' #'copyReplaceAll:with:' #'copyReplaceFrom:to:with:' copyUpTo: copyUpToLast: copyWith: copyWithout: copyWithoutAll: #'forceTo:paddingWith:'
+ , #'copyAfterLast:' #'copyAt:put:'
+ #'copyFrom:to:'
+ #'copyReplaceAll:with:' #'copyReplaceFrom:to:with:'
+ #'copyUpTo:' #'copyUpToLast:'
+ #'copyWith:' #'copyWithout:' #'copyWithoutAll:'
+ #'forceTo:paddingWith:'
"shuffled -- not useful"
sortBy:
"enumerating"
@@ -854,7 +857,8 @@
#'copyReplaceAll:with:asTokens:'
"ST/X copying"
- copyButLast: copyLast: copyFrom: copyTo: last: first:
+ copyButLast: copyLast: copyFrom: copyTo: #'copyFrom:count:' #'copyBetween:and:caseSensitive:'
+ last: first:
splitBy:
"ST/X testing"
longestCommonPrefix
@@ -1521,7 +1525,9 @@
true "Approved isNil" ifTrue: [self initialize]. "Sets of allowed selectors"
expressions := OrderedCollection new.
self search: true. "multi"
- expressions isEmpty ifTrue: [^ OrderedCollection with: 'no single method does that function'].
+ expressions isEmpty ifTrue: [
+ ^ OrderedCollection with: 'no single method found, which does that function\(but to be honest, I did not try all of them, so there may be one actually)'
+ ].
expressions isString ifTrue: [^ OrderedCollection with: expressions].
^ expressions
!
@@ -1598,16 +1604,17 @@
simpleSearch
"Run through first arg's class' selectors, looking for one that works."
-| class supers listOfLists |
+| class supers listOfLists numArgs|
self exceptions.
class:=thisData first first class.
+numArgs := (argMap size) - 1.
"Cache the selectors for the receiver class"
-(class == cachedClass and: [cachedArgNum = ((argMap size) - 1)])
+(class == cachedClass and: [cachedArgNum = numArgs])
ifTrue: [listOfLists:=cachedSelectorLists]
- ifFalse: [supers:=class withAllSuperclasses.
+ ifFalse: [
+ supers:=class withAllSuperclasses.
listOfLists:=OrderedCollection new.
- supers do: [:cls |
- listOfLists add: (cls selectorsWithArgs: (argMap size) - 1)].
+ supers do: [:cls | listOfLists add: (cls selectorsWithArgs:numArgs) ].
cachedClass:=class.
cachedArgNum:=(argMap size) - 1.
cachedSelectorLists:=listOfLists].
@@ -1635,6 +1642,8 @@
|sz argList val rec activeSel perform argIsBlock expectedAnswer|
+"/ (aSelector startsWith:'copy') ifTrue:[Transcript showCR:aSelector].
+
"Transcript cr; show: aSelector. debug"
perform := aSelector beginsWith:'perform:'.
sz := argMap size.
@@ -1686,10 +1695,13 @@
val :=
[
[
+ (selector startsWith:'copy') ifTrue:[Transcript showCR:selector].
rec copy perform:aSelector withArguments:argList
] on:ObsoleteMethodCallWarning do:[
^ false
].
+ ] on:HaltInterrupt do:[:ex |
+ ex proceed
] on:Error do:[:ex |
"/ Transcript showCR:aSignal description.
"self test3."