[Pkg] The Trunk: Collections-eem.367.mcz

commits at source.squeak.org commits at source.squeak.org
Wed Jun 30 17:12:16 UTC 2010


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

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

Name: Collections-eem.367
Author: eem
Time: 29 June 2010, 5:33:09.841 pm
UUID: f8a9fe6b-b224-4a6b-96ed-04c03a98222d
Ancestors: Collections-eem.366

Fix bug in Symbol class>>selectorsContaining: which won''t find selectors containing digits.
Add Symbol class>>selectorsMatching:.
Both the above used in improved MessageNames

=============== Diff against Collections-eem.366 ===============

Item was changed:
  ----- Method: Symbol class>>selectorsContaining: (in category 'access') -----
  selectorsContaining: aString
  	"Answer a list of selectors that contain aString within them. Case-insensitive.  Does return symbols that begin with a capital letter."
  
  	| size selectorList ascii |
  
  	selectorList := OrderedCollection new.
  	(size := aString size) = 0 ifTrue: [^selectorList].
  
  	aString size = 1 ifTrue:
  		[
  			ascii := aString first asciiValue.
  			ascii < 128 ifTrue: [selectorList add: (OneCharacterSymbols at: ascii+1)]
  		].
  
+ 	(aString first isLetter or: [aString first isDigit]) ifFalse:
- 	aString first isLetter ifFalse:
  		[
  			aString size == 2 ifTrue: 
  				[Symbol hasInterned: aString ifTrue:
  					[:s | selectorList add: s]].
  			^selectorList
  		].
  
  	selectorList := selectorList copyFrom: 2 to: selectorList size.
  
  	self allSymbolTablesDo: [:each |
  		each size >= size ifTrue:
+ 			[(each findSubstring: aString in: each startingAt: 1 
+ 				matchTable: CaseInsensitiveOrder) > 0
- 			[(each findString: aString startingAt: 1 caseSensitive: false) > 0
  						ifTrue: [selectorList add: each]]].
  
  	^selectorList reject: [:each | "reject non-selectors, but keep ones that begin with an uppercase"
  		each numArgs < 0 and: [each asString withFirstCharacterDownshifted numArgs < 0]].
  
  "Symbol selectorsContaining: 'scon'"!

Item was added:
+ ----- Method: Symbol class>>selectorsMatching: (in category 'access') -----
+ selectorsMatching: aStringPattern
+ 	"Answer a list of selectors that match aStringPattern within them. Case-insensitive.
+ 	 Does return symbols that begin with a capital letter."
+ 
+ 	| selectorList |
+ 
+ 	selectorList := OrderedCollection new.
+ 
+ 	aStringPattern isEmpty ifTrue: [^selectorList].
+ 
+ 	self allSymbolTablesDo:
+ 		[:each | (aStringPattern match: each) ifTrue: [selectorList add: each]].
+ 
+ 	^selectorList reject: "reject non-selectors, but keep ones that begin with an uppercase"
+ 		[:each | each numArgs < 0 and: [each asString withFirstCharacterDownshifted numArgs < 0]]
+ 
+ 	"Symbol selectorsMatching: 'parse:*'"!



More information about the Packages mailing list