Nicolas Cellier uploaded a new version of Collections to project The Trunk:
http://source.squeak.org/trunk/Collections-nice.508.mcz==================== Summary ====================
Name: Collections-nice.508
Author: nice
Time: 11 March 2013, 10:10:43.385 pm
UUID: 23f2049a-76c4-4ea4-aad6-71513d70aa6a
Ancestors: Collections-fbs.507
Let String>>numArgs pass its tests
=============== Diff against Collections-fbs.507 ===============
Item was changed:
----- Method: String>>numArgs (in category 'accessing') -----
numArgs
"Answer either the number of arguments that the receiver would take if considered a selector. Answer -1 if it couldn't be a selector. It is intended mostly for the assistance of spelling correction."
| firstChar numColons start ix |
self size = 0 ifTrue: [ ^-1 ].
firstChar := self at: 1.
firstChar isSpecial ifTrue: [
2 to: self size do: [ :i | (self at: i) isSpecial ifFalse: [ ^-1 ] ].
^1 ].
- firstChar isLetter ifFalse: [ ^-1 ].
self canBeToken ifFalse: [ ^-1 ].
"Fast colon count"
numColons := 0.
start := 1.
+ [(firstChar isLetter or: [firstChar = $:]) ifFalse: [ ^-1 ].
+ (ix := self indexOf: $: startingAt: start) > 0 ] whileTrue: [
- [ (ix := self indexOf: $: startingAt: start) > 0 ] whileTrue: [
numColons := numColons + 1.
+ (start := ix + 1) > self size ifFalse: [firstChar := self at: start]].
- start := ix + 1].
(numColons > 0 and: [ self last ~= $: ]) ifTrue: [ ^-1 ].
^numColons!