Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix browsing of refs/defs to vars broken by recent command query changes #1219

Merged
merged 3 commits into from
Dec 17, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion Core/Contributions/Camp Smalltalk/SUnit/SUnit.pax
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ Core.Object
classConstants: {}!
Core.Object
subclass: #'XProgramming.SUnit.TestSuite'
instanceVariableNames: 'tests resources name'
instanceVariableNames: 'tests resources name dependents'
classVariableNames: ''
imports: #()
classInstanceVariableNames: ''
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

Core.Object
subclass: #'XProgramming.SUnit.TestSuite'
instanceVariableNames: 'tests resources name'
instanceVariableNames: 'tests resources name dependents'
classVariableNames: ''
imports: #()
classInstanceVariableNames: ''
Expand Down Expand Up @@ -30,6 +30,9 @@ defaultResources
addAll: testCase resources;
yourself]!

getDependents
^dependents!

name
^name!

Expand Down Expand Up @@ -63,6 +66,9 @@ run: aResult
each run: aResult]]
ensure: [aResult duration: (Delay microsecondClockValue - start) microseconds]!

setDependents: aDependentsCollectionOrNil
dependents := aDependentsCollectionOrNil!

tests
tests isNil ifTrue: [tests := OrderedCollection new].
^tests! !
Expand All @@ -71,13 +77,15 @@ addDependentToHierachy:!Dependencies!public! !
addTest:!Accessing!public! !
addTests:!Accessing!public! !
defaultResources!Accessing!public! !
getDependents!dependency!private! !
name!Accessing!public! !
name:!Accessing!public! !
removeDependentFromHierachy:!Dependencies!public! !
resources!Accessing!public! !
resources:!Accessing!public! !
run!public!Running! !
run:!public!Running! !
setDependents:!dependency!private! !
tests!Accessing!public! !
!

Expand Down
1 change: 0 additions & 1 deletion Core/Contributions/Odellsoft/SUnitBrowser/SUnitBrowser.pax
Original file line number Diff line number Diff line change
Expand Up @@ -105,7 +105,6 @@ package setPrerequisites: #(
'..\..\..\Object Arts\Dolphin\MVP\Presenters\Text\Dolphin Text Presenter'
'..\..\..\Object Arts\Dolphin\MVP\Icons\Dolphin Text Tile Icons'
'..\..\..\Object Arts\Dolphin\MVP\Type Converters\Dolphin Type Converters'
'..\..\Refactory\Refactoring Browser\Environments\RBEnvironments'
'..\..\Camp Smalltalk\SUnit\SUnit'
'SUnitBrowserModelApp').

Expand Down
2 changes: 1 addition & 1 deletion Core/Object Arts/Dolphin/Base/DolphinClasses.st
Original file line number Diff line number Diff line change
Expand Up @@ -2502,7 +2502,7 @@ Core.Object
classConstants: {}!
Core.Object
subclass: #'Kernel.CompilationResult'
instanceVariableNames: 'method rawTextMap rawTempsMap textMap tempsMap oldMethod package'
instanceVariableNames: 'method rawTextMap rawTempsMap flags textMap tempsMap oldMethod package'
classVariableNames: ''
imports: #()
classInstanceVariableNames: ''
Expand Down
20 changes: 13 additions & 7 deletions Core/Object Arts/Dolphin/Base/Kernel.CompilationResult.cls
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

Core.Object
subclass: #'Kernel.CompilationResult'
instanceVariableNames: 'method rawTextMap rawTempsMap textMap tempsMap oldMethod package'
instanceVariableNames: 'method rawTextMap rawTempsMap flags textMap tempsMap oldMethod package'
classVariableNames: ''
imports: #()
classInstanceVariableNames: ''
Expand Down Expand Up @@ -51,6 +51,9 @@ fireSystemUpdateEvent
ifTrue: [method methodClass annotationsUpdated: self].
Smalltalk trigger: (self isNew ifTrue: [#methodAdded:] ifFalse: [#methodUpdated:]) with: self!

isInteractive
^flags allMask: CompilerFlags.Interactive!

isNew
^oldMethod isNil!

Expand All @@ -65,10 +68,11 @@ method: aCompiledMethod

method := aCompiledMethod!

method: aCompiledMethod rawTextMap: textArray rawTempsMap: tempsArray
method: aCompiledMethod rawTextMap: textArray rawTempsMap: tempsArray flags: anInteger
method := aCompiledMethod.
rawTextMap := textArray.
rawTempsMap := tempsArray!
rawTempsMap := tempsArray.
flags := anInteger!

oldMethod
^oldMethod!
Expand Down Expand Up @@ -112,10 +116,11 @@ affectsAnnotation:!enquiries!public! !
buildTempsMap!development!private! !
buildTextMap!development!private! !
fireSystemUpdateEvent!helpers!private! !
isInteractive!public!testing! !
isNew!accessing!public! !
method!accessing!public! !
method:!accessing!private! !
method:rawTextMap:rawTempsMap:!initializing!private! !
method:rawTextMap:rawTempsMap:flags:!initializing!private! !
oldMethod!accessing!public! !
oldMethod:!accessing!public! !
package!accessing!public! !
Expand All @@ -129,13 +134,14 @@ textMap!accessing!development!public! !

!Kernel.CompilationResult class methodsFor!

method: aCompiledMethod rawTextMap: textArray rawTempsMap: tempsArray
method: aCompiledMethod rawTextMap: textArray rawTempsMap: tempsArray flags: anInteger
<primitive: 157>
^self new
method: aCompiledMethod
rawTextMap: textArray
rawTempsMap: tempsArray! !
rawTempsMap: tempsArray
flags: anInteger! !
!Kernel.CompilationResult class categoriesForMethods!
method:rawTextMap:rawTempsMap:!instance creation!public! !
method:rawTextMap:rawTempsMap:flags:!instance creation!public! !
!

6 changes: 4 additions & 2 deletions Core/Object Arts/Dolphin/Base/Kernel.Compiler.cls
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,8 @@ compile: aString in: aClass environment: aNamespaceOrNil flags: anInteger
^CompilationResult
method: results first
rawTextMap: results second
rawTempsMap: results third!
rawTempsMap: results third
flags: anInteger!

compileDebugExpression: aString in: aClass environment: aNamespaceOrNil evaluationPools: anArray
^(self
Expand Down Expand Up @@ -148,7 +149,8 @@ compileForEvaluation: aString in: aBehaviorOrNil environment: aNamespaceOrNil ev
results := CompilationResult
method: expression
rawTextMap: results second
rawTempsMap: results third.
rawTempsMap: results third
flags: anInteger.
expression notNil
ifTrue:
[aBehaviorOrNil ifNotNil: [expression methodClass: aBehaviorOrNil].
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ Tools.AnnotatedMethodSearch guid: (Core.GUID fromString: '{ba126645-8637-444f-b9
Tools.AnnotatedMethodSearch comment: ''!
!Tools.AnnotatedMethodSearch methodsFor!

methodReferenceFilter
referenceFilter
"Private - Answer a <monadicValuable> which can be used to discriminate between <CompiledMethod>s that
match this search and those that do not."

Expand All @@ -20,7 +20,7 @@ methodReferenceFilter
referencesLabelTag
^#annotated! !
!Tools.AnnotatedMethodSearch categoriesForMethods!
methodReferenceFilter!helpers!private! !
referenceFilter!accessing!private! !
referencesLabelTag!constants!public! !
!

6 changes: 3 additions & 3 deletions Core/Object Arts/Dolphin/IDE/Base/Tools.ClassSelector.cls
Original file line number Diff line number Diff line change
Expand Up @@ -196,7 +196,7 @@ buildAllVariablesMenu: aMenu
[self
populateVarMenu: aMenu
class: class
command: #browseReferencesToInstVars:inHierarchyOf:within:
command: #browseReferencesToInstVar:inHierarchyOf:within:
variables: instVars
format: '<1s>.<2s>'
abortable: false].
Expand All @@ -211,7 +211,7 @@ buildAllVariablesMenu: aMenu
[self
populateVarMenu: aMenu
class: class
command: #browseReferencesToClassVars:of:within:
command: #browseReferencesToClassVar:of:within:
variables: classVars
format: '<1s>.<2s>'
abortable: false]!
Expand Down Expand Up @@ -810,7 +810,7 @@ populateVarMenu: aMenu class: class command: cmdSelector variables: aCollection
msg := MessageSend
receiver: self developmentSystem
selector: cmdSelector
arguments: { { each value }. class. self searchEnvironment }.
arguments: { each value. class. self searchEnvironment }.
(aMenu addCommand: msg
description: (aString expandMacrosWithArguments: { each key name. each value }
locale: Locale smalltalk))
Expand Down
2 changes: 1 addition & 1 deletion Core/Object Arts/Dolphin/IDE/Base/Tools.MethodBrowser.cls
Original file line number Diff line number Diff line change
Expand Up @@ -970,7 +970,7 @@ saveMethod: aString in: aClass environment: aNamespace categories: aCollection p
environment: aNamespace
categories: aCollection
package: aPackageOrNil
extraFlags: (sourcePresenter isAutoParseEnabled ifTrue: [0] ifFalse: [Interactive])]
extraFlags: Interactive]
on: Compiler notificationClass
do: [:cn | sourcePresenter compilerNotification: cn offset: 0].
newMethod := change ifNotNil: [change method].
Expand Down
65 changes: 33 additions & 32 deletions Core/Object Arts/Dolphin/IDE/Base/Tools.MethodSearch.cls
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

Core.Object
subclass: #'Tools.MethodSearch'
instanceVariableNames: 'findDetails regexp literal'
instanceVariableNames: 'findDetails regexp literal referenceFilter'
classVariableNames: ''
imports: #()
classInstanceVariableNames: ''
Expand All @@ -21,8 +21,21 @@ Class Variables:
!Tools.MethodSearch categoriesForClass!Kernel-Objects! !
!Tools.MethodSearch methodsFor!

definitionFilter
"Answer a <monadicValuable> which can be used to discriminate between <CompiledMethod>s that
match this selector search and those that do not."

| type |
type := self searchMode.
^type == #regularExpression
ifTrue: [self regexpDefinitionFilter]
ifFalse:
[type == #wildcardExpression
ifTrue: [self wildcardDefinitionFilter]
ifFalse: [self literalDefinitionFilter]]!

definitionsIn: aBrowserEnvironment
^(aBrowserEnvironment filterMethods: self methodDefinitionFilter)
^(aBrowserEnvironment filterMethods: self definitionFilter)
label: (aBrowserEnvironment subEnvironmentLabel: #definitions for: self pattern);
search: self;
yourself!
Expand Down Expand Up @@ -61,32 +74,6 @@ literalSymbolsFilter: matchBlock
matchesIn: aBrowserEnvironment
^{ self definitionsIn: aBrowserEnvironment. self referencesIn: aBrowserEnvironment }!

methodDefinitionFilter
"Private - Answer a <monadicValuable> which can be used to discriminate between <CompiledMethod>s that
match this selector search and those that do not."

| type |
type := self searchMode.
^type == #regularExpression
ifTrue: [self regexpDefinitionFilter]
ifFalse:
[type == #wildcardExpression
ifTrue: [self wildcardDefinitionFilter]
ifFalse: [self literalDefinitionFilter]]!

methodReferenceFilter
"Private - Answer a <monadicValuable> which can be used to discriminate between <CompiledMethod>s that
match this selector search and those that do not."

| type |
type := self searchMode.
^type == #regularExpression
ifTrue: [self regexpReferenceFilter]
ifFalse:
[type == #wildcardExpression
ifTrue: [self wildcardReferenceFilter]
ifFalse: [self simpleReferenceFilter]]!

pattern
"Answer the receiver's current search pattern <String>. The interpretation of this string is
dependant upon the search type mode."
Expand All @@ -96,8 +83,22 @@ pattern
pattern: aString
findDetails pattern: aString!

referenceFilter
"Answer a <monadicValuable> which can be used to discriminate between <CompiledMethod>s that match this selector search and those that do not."

^referenceFilter
ifNil:
[| type |
type := self searchMode.
referenceFilter := type == #regularExpression
ifTrue: [self regexpReferenceFilter]
ifFalse:
[type == #wildcardExpression
ifTrue: [self wildcardReferenceFilter]
ifFalse: [self simpleReferenceFilter]]]!

referencesIn: aBrowserEnvironment
^(aBrowserEnvironment filterMethods: self methodReferenceFilter)
^(aBrowserEnvironment filterMethods: self referenceFilter)
label: (aBrowserEnvironment labelFormats at: self referencesLabelTag)
<< { self pattern. aBrowserEnvironment. self searchMode asPhrase };
search: self;
Expand Down Expand Up @@ -188,19 +189,19 @@ wildcardReferenceFilter
ignoreCase := findDetails isCaseSensitive not.
^self literalSymbolsFilter: [:each | match match: each ignoreCase: ignoreCase]! !
!Tools.MethodSearch categoriesForMethods!
definitionFilter!accessing!public! !
definitionsIn:!enquiries!public! !
findDetails!accessing!public! !
findDetails:!accessing!public! !
initialize!initializing!public! !
literal!public! !
literal!accessing!public! !
literal:!accessing!public! !
literalDefinitionFilter!helpers!private! !
literalSymbolsFilter:!helpers!private! !
matchesIn:!enquiries!public! !
methodDefinitionFilter!helpers!private! !
methodReferenceFilter!helpers!private! !
pattern!accessing!public! !
pattern:!accessing!public! !
referenceFilter!accessing!public! !
referencesIn:!enquiries!public! !
referencesLabelTag!constants!public! !
regexpDefinitionFilter!helpers!private! !
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,11 +15,11 @@ Tools.MethodSourceSearch comment: ''!
methodFilter: aMonadicValuable
^[:each | each getSource ifNil: [false] ifNotNil: [:src | aMonadicValuable value: src]]!

methodReferenceFilter
referenceFilter
"Private - Answer a <monadicValuable> which can be used to discriminate between <CompiledMethod>s that
match this search and those that do not."

^self methodFilter: super methodReferenceFilter!
^self methodFilter: super referenceFilter!

referencesLabelTag
^#containing!
Expand Down Expand Up @@ -58,7 +58,7 @@ wildcardReferenceFilter
^[:text | match match: text ignoreCase: ignoreCase]! !
!Tools.MethodSourceSearch categoriesForMethods!
methodFilter:!helpers!private! !
methodReferenceFilter!helpers!private! !
referenceFilter!accessing!private! !
referencesLabelTag!constants!public! !
regexpReferenceFilter!helpers!private! !
simpleReferenceFilter!helpers!private! !
Expand Down
Loading