Converting old Spotter searches to use new Spotter

This page converts many of the old spotter search methods into the new format. These rewrites should be applied in order.

Create a filter for the scope of the rewrites below

The scope is all <gtSearch> pragma methods that send listProcessor and don't use the filter:item: method from the old spotter as those methods need to be manually converted. Since the listProcessor is converted to list towards the bottom, we need to search for both or rewrites that appear after the conversion will not work.

searchMethods := #gtSearch gtPragmas
		& (#listProcessor gtReferences | #list gtReferences)
		& #filter:item: gtReferences not
  

Rename messages used by the old listProcessor

`@a listProcessor filter: GtFilterSubstring
  
`@a listProcessor filterBySubstring
  
`@a listProcessor allCandidates: `@block
  
`@a listProcessor items: `@block
  
`@a listProcessor actLogic: `@block
  
`@a listProcessor itemActLogic: `@block
  

Remove not supported items

`@a listProcessor 
	`@;cascadesBefore; 
	itemIcon: `@block; 
	`@;cascadesAfter
  
`@a listProcessor
	`@;cascadesBefore; 
	"itemIcon: `@block; "
	`@;cascadesAfter
  
`@a listProcessor 
	`@;cascadesBefore; 
	keyBinding: `@b; 
	`@;cascadesAfter
  
`@a listProcessor
	`@;cascadesBefore; 
	"keyBinding: `@b; "
	`@;cascadesAfter
  

Fix the return values

^self  `{:node :dict | 
	dict at: #variable put: node methodNode arguments first name. 
	true}
  
^`{:dict | RBVariableNode named: (dict at: #variable)} empty
  
(`@a listProcessor `;cascade; `@;cascades) `{:node | 
	(node allParents noneSatisfy: [:each | each isReturn])}
  
^`@a listProcessor `;cascade; `@;cascades
  
^(`@bool ifTrue: `@true) `{:node :dict | 
	dict at: #variable put: node methodNode arguments first name.
	true}
  
^ `@bool 
	ifTrue: `@true 
	ifFalse: [`{:dict | RBVariableNode named: (dict at: #variable)} empty]
  

Rename aStep argument to aSearch

`{:node :dict | node isVariable and: [
	node name asString ~= 'aSearch' and: [
		| arg |
		arg := node methodNode arguments first.
		dict at: #arg put: arg.
		arg
			propertyAt: #original
			ifPresent: [ :original | node = original ]
			ifAbsent: [ arg = node ]]]}
  
`{:dict | 
	| arg |
	arg := dict at: #arg.
	arg
		propertyAt: #original
		ifAbsent: 
			[ arg replaceWith: 
				((RBVariableNode named: 'aSearch') 
					propertyAt: #original put: arg; 
					yourself) ].
	RBVariableNode named: 'aSearch' }
  

Finally change the listProcessor message

`@a listProcessor
  
`@a list