[squeak-dev] The Trunk: Collections-eem.806.mcz

commits at source.squeak.org commits at source.squeak.org
Tue Sep 18 18:54:25 UTC 2018


Eliot Miranda uploaded a new version of Collections to project The Trunk:
http://source.squeak.org/trunk/Collections-eem.806.mcz

==================== Summary ====================

Name: Collections-eem.806
Author: eem
Time: 18 September 2018, 11:54:09.798435 am
UUID: 300fdef5-d563-4e05-b16c-f82c15cc005f
Ancestors: Collections-cmm.805

Fix String>>numArgs for _: keywords (to accompany Compiler-eem.394)

=============== Diff against Collections-cmm.805 ===============

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."
  
+ 	| numColons index size c |
- 	| numColons index size |
  	(size := self size) = 0 ifTrue: [ ^-1 ].
  	index := 1.
  	(self at: index) isSpecial ifTrue: [
  		2 to: size do: [ :i | (self at: i) isSpecial ifFalse: [ ^-1 ] ].
  		^1 ].
  	self canBeToken ifFalse: [ ^-1 ].
  	"Fast colon count"
  	numColons := 0.
  	[ 
+ 		((c := self at: index) isLetter
+ 		 or: [ c = $_ and: [ Scanner prefAllowUnderscoreSelectors ] ]) ifFalse:
+ 			[ ^-1 ].
+ 		(index := (self indexOf: $: startingAt: index) + 1) > 1 ifFalse:
+ 			[ numColons = 0 ifTrue: [ ^0 ].
+ 			 ^-1 ].
- 		(self at: index) isLetter ifFalse: [ ^-1 ].
- 		(index := (self indexOf: $: startingAt: index) + 1) > 1 ifFalse: [ 
- 			numColons = 0 ifTrue: [ ^0 ].
- 			^-1 ].
  		numColons := numColons + 1.
  		index <= size ] whileTrue.
  	^numColons!



More information about the Squeak-dev mailing list