Skip to content

Move #hasBindingThatBeginsWith: to Shout #17932

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

Open
wants to merge 7 commits into
base: Pharo13
Choose a base branch
from
Open
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
10 changes: 0 additions & 10 deletions src/AST-Core/OCVariableNode.class.st
Original file line number Diff line number Diff line change
Expand Up @@ -96,16 +96,6 @@ OCVariableNode >> equalTo: anObject withMapping: aDictionary [
= anObject name ]
]

{ #category : 'testing' }
OCVariableNode >> hasIncompleteIdentifier [
"check if there is any variable declared in my scope that starts with my name"

"declared vars are never incomplete"
variable isUndeclaredVariable ifFalse: [ ^false ].
"for the others we have to search from the current scope"
^self scope hasBindingThatBeginsWith: self name
]

{ #category : 'comparing' }
OCVariableNode >> hash [
^self name hash
Expand Down
21 changes: 7 additions & 14 deletions src/BaselineOfIDE/BaselineOfIDE.class.st
Original file line number Diff line number Diff line change
Expand Up @@ -73,15 +73,14 @@ BaselineOfIDE >> baseline: spec [

self load: 'Metacello' group: 'Tests' spec: spec.

spec baseline: 'ReflectionMirrors' with: [ spec repository: repository ].
spec baseline: 'FuzzyMatcher' with: [ spec repository: repository ].
spec baseline: 'QA' with: [ spec repository: repository ].
spec baseline: 'GeneralTests' with: [ spec repository: repository ].

"Later we will load the UI of enlumineur probably here
"
spec baseline: 'Shout' with: [ spec repository: repository ].

spec
baseline: 'ReflectionMirrors'
with: [ spec repository: repository ].
spec baseline: 'FuzzyMatcher' with: [ spec repository: repository ].
spec baseline: 'QA' with: [ spec repository: repository ].
spec baseline: 'OSWindow' with: [ spec repository: repository ].
spec
baseline: 'EmergencyDebugger'
Expand All @@ -93,8 +92,6 @@ BaselineOfIDE >> baseline: spec [

self load: 'Fuel' group: 'Tests' spec: spec.

spec baseline: 'GeneralTests' with: [ spec repository: repository ].

self load: 'FreeType' group: 'tests' spec: spec.
self load: 'Keymapping' group: 'tests' spec: spec.

Expand All @@ -108,9 +105,7 @@ BaselineOfIDE >> baseline: spec [
spec package: 'BaselineOfPharoBootstrap'.
spec package: 'BaselineOfMonticello'.
spec package: 'BaselineOfMetacello'.
spec
baseline: 'ReferenceFinder'
with: [ spec repository: repository ].
spec baseline: 'ReferenceFinder' with: [ spec repository: repository ].
spec baseline: 'ClassParser' with: [ spec repository: repository ].


Expand All @@ -119,9 +114,7 @@ BaselineOfIDE >> baseline: spec [
group: #( 'FullEnvironment' 'SystemBrowser' 'Tests' )
spec: spec.
spec baseline: 'Ring' with: [ spec repository: repository ].
spec
baseline: 'HeuristicCompletion'
with: [ spec repository: repository ].
spec baseline: 'HeuristicCompletion' with: [ spec repository: repository ].
spec package: 'Tool-DependencyAnalyser-UI-Tab' with: [
"Depends also on the dependency analyser in newtools"
spec requires: #('Calypso') ].
Expand Down
5 changes: 0 additions & 5 deletions src/Collections-Sequenceable/OrderedDictionary.class.st
Original file line number Diff line number Diff line change
Expand Up @@ -313,11 +313,6 @@ OrderedDictionary >> growOrderedKeys [
startingAt: 1
]

{ #category : 'testing' }
OrderedDictionary >> hasBindingThatBeginsWith: aString [
^ dictionary hasBindingThatBeginsWith: aString
]

{ #category : 'comparing' }
OrderedDictionary >> hash [
^ dictionary hash
Expand Down
13 changes: 0 additions & 13 deletions src/Collections-Unordered-Tests/DictionaryTest.class.st
Original file line number Diff line number Diff line change
Expand Up @@ -477,19 +477,6 @@ DictionaryTest >> testFlatCollect3 [
self assert: res asSet equals: #(#(2 3) #(4 5)) asSet
]

{ #category : 'tests - testing' }
DictionaryTest >> testHasBindingThatBeginsWith [
| newDict |
newDict := self collectionClass new
at: #abc put: 10;
at: #abcd put: 100;
at: #def put: 20;
yourself.
self assert: (newDict hasBindingThatBeginsWith: 'ab').
self assert: (newDict hasBindingThatBeginsWith: 'def').
self deny: (newDict hasBindingThatBeginsWith: 'defg')
]

{ #category : 'tests - testing' }
DictionaryTest >> testIncludeAssociation [
self assert: (nonEmptyDict includesAssociation: #a -> self elementTwiceIn).
Expand Down
10 changes: 0 additions & 10 deletions src/Collections-Unordered/Dictionary.class.st
Original file line number Diff line number Diff line change
Expand Up @@ -552,16 +552,6 @@ Dictionary >> flatCollect: aBlock [
^ self flatCollect: aBlock as: OrderedCollection
]

{ #category : 'testing' }
Dictionary >> hasBindingThatBeginsWith: aString [
"Answer true if the receiver has a key that begins with aString, false otherwise"

self keysDo:[:each |
(each beginsWith: aString)
ifTrue:[^true]].
^false
]

{ #category : 'testing' }
Dictionary >> includes: anObject [

Expand Down
10 changes: 0 additions & 10 deletions src/Collections-Unordered/SmallDictionary.class.st
Original file line number Diff line number Diff line change
Expand Up @@ -472,16 +472,6 @@ SmallDictionary >> growTo: aSize [
values := newValues
]

{ #category : 'testing' }
SmallDictionary >> hasBindingThatBeginsWith: aString [
"Answer true if the receiver has a key that begins with aString, false otherwise"

self keysDo:[:each |
(each beginsWith: aString)
ifTrue:[^true]].
^false
]

{ #category : 'testing' }
SmallDictionary >> includes: aValue [
self do: [:each | aValue = each ifTrue: [^true]].
Expand Down
6 changes: 0 additions & 6 deletions src/Kernel-CodeModel/AbstractLayout.class.st
Original file line number Diff line number Diff line change
Expand Up @@ -94,12 +94,6 @@ AbstractLayout >> fieldSize [
^ 0
]

{ #category : 'testing' }
AbstractLayout >> hasBindingThatBeginsWith: aString [
"Answer true if there is a Slot that begins with aString, false otherwise"
^false
]

{ #category : 'testing' }
AbstractLayout >> hasFields [
^ false
Expand Down
5 changes: 0 additions & 5 deletions src/Kernel-CodeModel/AbstractLayoutScope.class.st
Original file line number Diff line number Diff line change
Expand Up @@ -77,11 +77,6 @@ AbstractLayoutScope >> flattenIn: aCollection [
self subclassResponsibility
]

{ #category : 'accessing' }
AbstractLayoutScope >> hasBindingThatBeginsWith: arg1 [
^ self subclassResponsibility
]

{ #category : 'testing' }
AbstractLayoutScope >> hasFields [
self subclassResponsibility
Expand Down
17 changes: 0 additions & 17 deletions src/Kernel-CodeModel/Class.class.st
Original file line number Diff line number Diff line change
Expand Up @@ -565,23 +565,6 @@ Class >> hasAbstractMethods [
^ super hasAbstractMethods or: [ self classSide hasAbstractMethods ]
]

{ #category : 'compiling' }
Class >> hasBindingThatBeginsWith: aString [
"Answer true if the receiver has a binding that begins with aString, false otherwise"

"First check the slots / instance variabless"
(self classLayout hasBindingThatBeginsWith: aString) ifTrue: [^ true].

"Then look in classVar dictionary"
(self classPool hasBindingThatBeginsWith: aString) ifTrue: [ ^true].

"Next look in shared pools"
(self sharedPools anySatisfy: [:pool | pool hasBindingThatBeginsWith: aString ]) ifTrue: [ ^true].

"Last: go to the outer environment"
^ self environment hasBindingThatBeginsWith: aString
]

{ #category : 'accessing - parallel hierarchy' }
Class >> hasClassSide [
<reflection: 'Class structural inspection - Class/Metaclass shift'>
Expand Down
10 changes: 0 additions & 10 deletions src/Kernel-CodeModel/LayoutClassScope.class.st
Original file line number Diff line number Diff line change
Expand Up @@ -63,16 +63,6 @@ LayoutClassScope >> flattenIn: aCollection [
^ aCollection
]

{ #category : 'enumerating' }
LayoutClassScope >> hasBindingThatBeginsWith: aString [
"Answer true if there is a Slot name that begins with aString, false otherwise"

self allSlotsDo: [:each |
(each name beginsWith: aString)
ifTrue:[^true]].
^false
]

{ #category : 'testing' }
LayoutClassScope >> hasFields [
self do: [ :slot |
Expand Down
5 changes: 0 additions & 5 deletions src/Kernel-CodeModel/LayoutEmptyScope.class.st
Original file line number Diff line number Diff line change
Expand Up @@ -38,11 +38,6 @@ LayoutEmptyScope >> flattenIn: aCollection [
^ aCollection
]

{ #category : 'testing' }
LayoutEmptyScope >> hasBindingThatBeginsWith: aString [
^false
]

{ #category : 'testing' }
LayoutEmptyScope >> hasFields [
^ false
Expand Down
6 changes: 0 additions & 6 deletions src/Kernel-CodeModel/Metaclass.class.st
Original file line number Diff line number Diff line change
Expand Up @@ -155,12 +155,6 @@ Metaclass >> expandedDefinitionStringFor: aPrinter [
^ aPrinter expandedMetaclassDefinitionString
]

{ #category : 'testing' }
Metaclass >> hasBindingThatBeginsWith: aString [
"class and pool vars are accessible from the class side the same as the instance side"
^self instanceSide hasBindingThatBeginsWith: aString
]

{ #category : 'accessing - parallel hierarchy - deprecated' }
Metaclass >> hasClassSide [
<reflection: 'Class structural inspection - Class/Metaclass shift'>
Expand Down
7 changes: 0 additions & 7 deletions src/Kernel-CodeModel/PointerLayout.class.st
Original file line number Diff line number Diff line change
Expand Up @@ -145,13 +145,6 @@ PointerLayout >> fieldSize [
^ slotScope fieldSize
]

{ #category : 'testing' }
PointerLayout >> hasBindingThatBeginsWith: aString [
"Answer true if there is a Slot that begins with aString, false otherwise"

^ self slotScope hasBindingThatBeginsWith: aString
]

{ #category : 'testing' }
PointerLayout >> hasFields [
^ slotScope hasFields
Expand Down
15 changes: 0 additions & 15 deletions src/Kernel-Extended-Tests/ClassTest.class.st
Original file line number Diff line number Diff line change
Expand Up @@ -280,21 +280,6 @@ ClassTest >> testEnvironment: anObject [
testEnvironment := anObject
]

{ #category : 'tests' }
ClassTest >> testHasBindingThatBeginsWith [

"Lookup in slots of the current class.
This class defines #className"
self assert: (self class hasBindingThatBeginsWith: 'classNam').

"Pools are looked up, too"
self assert: (PoolDefiner hasBindingThatBeginsWith: 'AnAu').
self assert: (RootClassPoolUser hasBindingThatBeginsWith: 'AnAu').

"Lookup in globals too"
self assert: (self class hasBindingThatBeginsWith: 'Object').
]

{ #category : 'tests - class variables' }
ClassTest >> testHasClassVarNamed [

Expand Down
9 changes: 0 additions & 9 deletions src/Kernel-Tests/MetaClassTest.class.st
Original file line number Diff line number Diff line change
Expand Up @@ -6,15 +6,6 @@ Class {
#tag : 'Classes'
}

{ #category : 'tests' }
MetaClassTest >> testHasBindingThatBeginsWith [
self assert: (SmalltalkImage class hasBindingThatBeginsWith: 'Compiler').
self assert: (SmalltalkImage class hasBindingThatBeginsWith: 'Object').

"Pools are looked up, too"
self assert: (PoolDefiner class hasBindingThatBeginsWith: 'AnAu')
]

{ #category : 'tests' }
MetaClassTest >> testHasClassVarNamed [

Expand Down
10 changes: 0 additions & 10 deletions src/OpalCompiler-Core/OCAbstractMethodScope.class.st
Original file line number Diff line number Diff line change
Expand Up @@ -92,16 +92,6 @@ OCAbstractMethodScope >> copyEscapingReads [
thenDo: [ :each | self addCopyingTemp: each ]
]

{ #category : 'lookup' }
OCAbstractMethodScope >> hasBindingThatBeginsWith: aString [
"check weather there are any temporaries defined that start with aString"
(copiedVars hasBindingThatBeginsWith: aString) ifTrue: [ ^true ].
(tempVector hasBindingThatBeginsWith: aString) ifTrue: [ ^true ].
(tempVars hasBindingThatBeginsWith: aString) ifTrue: [ ^true ].

^ self outerScope hasBindingThatBeginsWith: aString
]

{ #category : 'temp vars - vector' }
OCAbstractMethodScope >> hasTempVector [
^ tempVector isNotEmpty
Expand Down
8 changes: 0 additions & 8 deletions src/OpalCompiler-Core/OCAbstractScope.class.st
Original file line number Diff line number Diff line change
Expand Up @@ -22,14 +22,6 @@ OCAbstractScope >> environment [
^self targetClass environment
]

{ #category : 'lookup' }
OCAbstractScope >> hasBindingThatBeginsWith: aString [
"check weather there are any variables defined that start with aString"
^ outerScope
ifNil: [ false ]
ifNotNil: [ outerScope hasBindingThatBeginsWith: aString ]
]

{ #category : 'testing' }
OCAbstractScope >> hasTempVector [
^ false
Expand Down
8 changes: 0 additions & 8 deletions src/OpalCompiler-Core/OCContextualDoItSemanticScope.class.st
Original file line number Diff line number Diff line change
Expand Up @@ -40,14 +40,6 @@ OCContextualDoItSemanticScope >> announceDoItEvaluation: aSourceString by: aSyst
aSystemAnnouncer evaluated: aSourceString context: targetContext
]

{ #category : 'testing' }
OCContextualDoItSemanticScope >> hasBindingThatBeginsWith: aString [

(targetContext astScope hasBindingThatBeginsWith: aString) ifTrue: [ ^true ].

^super hasBindingThatBeginsWith: aString
]

{ #category : 'lookup' }
OCContextualDoItSemanticScope >> importVariable: aVariable [

Expand Down
8 changes: 0 additions & 8 deletions src/OpalCompiler-Core/OCSemanticScope.class.st
Original file line number Diff line number Diff line change
Expand Up @@ -49,14 +49,6 @@ OCSemanticScope >> announceDoItEvaluation: aSourceString by: aSystemAnnouncer [
aSystemAnnouncer evaluated: aSourceString context: nil
]

{ #category : 'testing' }
OCSemanticScope >> hasBindingThatBeginsWith: aString [

(self targetClass hasBindingThatBeginsWith: aString) ifTrue: [ ^true ].

^super hasBindingThatBeginsWith: aString
]

{ #category : 'testing' }
OCSemanticScope >> isDoItScope [
^false
Expand Down
34 changes: 0 additions & 34 deletions src/OpalCompiler-Tests/OCScopeTest.class.st
Original file line number Diff line number Diff line change
Expand Up @@ -23,37 +23,3 @@ OCScopeTest >> ivarForTesting [

^ ivarForTesting
]

{ #category : 'tests' }
OCScopeTest >> testHasBindingThatBeginsWithClassVar [
self assert: (thisContext astScope hasBindingThatBeginsWith: 'MyClass').
self deny: (thisContext astScope hasBindingThatBeginsWith: 'NonExMYCL')
]

{ #category : 'tests' }
OCScopeTest >> testHasBindingThatBeginsWithGlobal [
self assert: (thisContext astScope hasBindingThatBeginsWith: 'Obj').
self deny: (thisContext astScope hasBindingThatBeginsWith: 'OBj')
]

{ #category : 'tests' }
OCScopeTest >> testHasBindingThatBeginsWithSlot [
self assert: (thisContext astScope hasBindingThatBeginsWith: 'ivarFo').
self deny: (thisContext astScope hasBindingThatBeginsWith: 'ivarForDoesNotExist').

"super and self, too"
self assert: (thisContext astScope hasBindingThatBeginsWith: 'sel').
self assert: (thisContext astScope hasBindingThatBeginsWith: 'sup')
]

{ #category : 'tests' }
OCScopeTest >> testHasBindingThatBeginsWithTemp [
| tempForTesting |
tempForTesting := 'only', 'forTest'.
self assert: (thisContext astScope hasBindingThatBeginsWith: 'tempFor').
self deny: (thisContext astScope hasBindingThatBeginsWith: 'TempForTest').

"thisContext is known, too"
self assert: (thisContext astScope hasBindingThatBeginsWith: 'thisC').
^tempForTesting
]
16 changes: 16 additions & 0 deletions src/Shout-Tests/ClassTest.extension.st
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
Extension { #name : 'ClassTest' }

{ #category : '*Shout-Tests' }
ClassTest >> testHasBindingThatBeginsWith [

"Lookup in slots of the current class.
This class defines #className"
self assert: (self class hasBindingThatBeginsWith: 'classNam').

"Pools are looked up, too"
self assert: (PoolDefiner hasBindingThatBeginsWith: 'AnAu').
self assert: (RootClassPoolUser hasBindingThatBeginsWith: 'AnAu').

"Lookup in globals too"
self assert: (self class hasBindingThatBeginsWith: 'Object').
]
Loading