'From Squeak5.3alpha of 2 September 2019 [latest update: #18838] on 2 September 2019 at 2:51:45 pm'!

!RBAbstractClass methodsFor: 'method accessing' stamp: 'mt 9/2/2019 14:36'!
existingMethodsThatReferTo: aSymbol 
	| existingMethods |
	existingMethods := self realClass whichSelectorsReferTo: aSymbol.
	(newMethods isNil and: [ removedMethods isNil ])
		ifTrue: [ ^ existingMethods ].
	^ existingMethods 
		reject: [ :each | (self hasRemoved: each) or: [ self newMethods includesKey: each ] ]! !


!RBBrowserEnvironmentTest methodsFor: 'testing' stamp: 'mt 9/2/2019 14:41'!
testSelectMethods
	| environment |
	environment := RBBrowserEnvironment new selectMethods: [:each | false].
	self assert: environment numberSelectors = 0.
	self assert: environment numberClasses = 0.
	environment := RBBrowserEnvironment new selectMethods: [:each | true].
	self assert: environment numberSelectors 
				= RBBrowserEnvironment new numberSelectors.
	environment := RBBrowserEnvironment new 
				selectMethods: [:each | each hasLiteral: #environment].
	self assert: environment numberSelectors 
				= (RBBrowserEnvironment new referencesTo: #environment) numberSelectors! !


!RBSelectorEnvironment class methodsFor: 'instance creation' stamp: 'mt 9/2/2019 14:41'!
referencesTo: aLiteral in: anEnvironment 
	| classDict literalPrintString |
	literalPrintString := aLiteral isVariableBinding
		ifTrue: [ aLiteral key asString ]
		ifFalse: [
			aLiteral isString
				ifTrue: [ aLiteral ]
				ifFalse: [ aLiteral printString ] ].
	classDict := IdentityDictionary new.
	anEnvironment classesDo: [ :class | 
		| selectors |
		selectors := (class whichSelectorsReferTo: aLiteral)
			select: [ :selector | anEnvironment includesSelector: selector in: class ].
		selectors isEmpty 
			ifFalse: [ classDict at: class put: selectors asIdentitySet ] ].
	^ (self onEnvironment: anEnvironment)
		on: classDict;
		label: 'References to: ' , literalPrintString;
		searchStrings: (Array with: literalPrintString);
		yourself! !


!RBUsesTrueRule methodsFor: 'running' stamp: 'mt 9/2/2019 14:42'!
checkMethod: aContext 
	| method |
	method := aContext compiledMethod.
	((method hasLiteral: trueBinding) or: [ method hasLiteral: falseBinding ]) ifTrue: 
		[ result 
			addClass: aContext selectedClass
			selector: aContext selector.
		result searchStrings: #('True' 'False' ) ]! !

