[squeak-dev] The Trunk: Morphic-mt.1491.mcz

Levente Uzonyi leves at caesar.elte.hu
Thu Jul 11 09:02:00 UTC 2019


Hi Marcel,

These changes should go the other way around. #hasInterned:ifTrue: is 
private and more specific. #lookup: is more general (#hasInterned:ifTrue: 
uses lookup) and faster.
In my opinion, #hasInterned:ifTrue: should be deprecated, then removed.

Levente

On Thu, 11 Jul 2019, commits at source.squeak.org wrote:

> Marcel Taeumel uploaded a new version of Morphic to project The Trunk:
> http://source.squeak.org/trunk/Morphic-mt.1491.mcz
>
> ==================== Summary ====================
>
> Name: Morphic-mt.1491
> Author: mt
> Time: 11 July 2019, 7:43:26.133838 am
> UUID: 8e7d61cb-067a-d145-a86e-3484bfb38617
> Ancestors: Morphic-cmfcmf.1490
>
> Replaces one use of Symbol class >> #lookup: with the more common (i.e., more senders) idiom Symbol class >> #hasInterned:ifTrue:.
>
> =============== Diff against Morphic-cmfcmf.1490 ===============
>
> Item was changed:
>  ----- Method: SearchBar>>smartSearch:in: (in category 'searching') -----
>  smartSearch: text in: morph
>  	"Take the user input and perform an appropriate search"
>  	| input newContents |
>  	self removeResultsWidget.
>  	input := text asString ifEmpty:[^self].
>  	self class useSmartSearch ifFalse: [^ ToolSet default browseMessageNames: input].
>
>  	"If it is a global or a full class name, browse that class."
>  	(Smalltalk bindingOf: input) ifNotNil:[:assoc| | global |
>  		global := assoc value.
>  		^ToolSet browse: (global isBehavior ifTrue:[global] ifFalse:[global class]) selector: nil].
>
>  	"If it is a symbol and there are implementors of it, browse those implementors."
> + 	Symbol hasInterned: input ifTrue: [:selector |
> - 	(Symbol lookup: input) ifNotNil: [:selector |
>  		(SystemNavigation new allImplementorsOf: selector) ifNotEmpty:[:list|
>  			^SystemNavigation new
>  				browseMessageList: list
>  				name: 'Implementors of ' , input]].
>
>  	"If it starts uppercase, browse classes if any. Otherwise, just search for messages."
>  	input first isUppercase
>  		ifTrue: [
>  			(UIManager default classFromPattern: input withCaption: '')
>  				ifNotNil:[:aClass| ^ToolSet browse: aClass selector: nil]
>  				ifNil: [
>  					newContents := input, ' -- not found.'.
>  					self searchTerm: newContents.
>  					self selection: (input size+1 to: newContents size).
>  					self currentHand newKeyboardFocus: morph textMorph.
>  					^ self]]
>  		ifFalse: [
>  			ToolSet default browseMessageNames: input].!


More information about the Squeak-dev mailing list