Skip to content

Commit

Permalink
Merge pull request pharo-project#6654 from dionisiydk/varProtocolCleanup
Browse files Browse the repository at this point in the history
Cleanup OCVariable protocol in Variable hierarchy
  • Loading branch information
MarcusDenker committed Jun 22, 2020
2 parents 0e12719 + d253438 commit 7544b03
Show file tree
Hide file tree
Showing 5 changed files with 28 additions and 28 deletions.
8 changes: 4 additions & 4 deletions src/Kernel/LiteralVariable.class.st
Original file line number Diff line number Diff line change
Expand Up @@ -113,19 +113,19 @@ LiteralVariable >> installingIn: aClass [
"I am called by the class builder. This way a class variable can change the class it is installed in"
]

{ #category : #OCVARIABLE }
{ #category : #testing }
LiteralVariable >> isGlobal [

^ true
]

{ #category : #OCVARIABLE }
{ #category : #testing }
LiteralVariable >> isGlobalClassNameBinding [
^ (self value isClass or: [ self value isTrait ])
and: [ name == self value name ]
]

{ #category : #OCVARIABLE }
{ #category : #testing }
LiteralVariable >> isLiteralVariable [
^true
]
Expand Down Expand Up @@ -157,7 +157,7 @@ LiteralVariable >> isVariableBinding [
^true
]

{ #category : #OCVARIABLE }
{ #category : #testing }
LiteralVariable >> isWritable [
"Literal variables are writable, if they aren't global bindings for class names, like
#Object -> Object "
Expand Down
2 changes: 1 addition & 1 deletion src/Kernel/Slot.class.st
Original file line number Diff line number Diff line change
Expand Up @@ -206,7 +206,7 @@ Slot >> isAccessedIn: aCompiledCode [
anySatisfy: [ :node | node binding == self ]
]

{ #category : #OCVARIABLE }
{ #category : #testing }
Slot >> isInstance [
^ true
]
Expand Down
4 changes: 2 additions & 2 deletions src/Kernel/UndeclaredVariable.class.st
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ UndeclaredVariable >> emitValue: methodBuilder [
methodBuilder pushLiteralVariable: self
]

{ #category : #OCVARIABLE }
{ #category : #testing }
UndeclaredVariable >> isGlobal [
^false
]
Expand All @@ -62,7 +62,7 @@ UndeclaredVariable >> isRegistered [
^Undeclared includesKey: name
]

{ #category : #OCVARIABLE }
{ #category : #testing }
UndeclaredVariable >> isUndeclared [

^ true
Expand Down
40 changes: 20 additions & 20 deletions src/Kernel/Variable.class.st
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,11 @@ Variable class >> initialize [
ifNotNil: [ (WeakIdentityKeyDictionary newFrom: Properties) rehash]
]

{ #category : #testing }
Variable class >> isAbstract [
^self = Variable
]

{ #category : #'instance creation' }
Variable class >> named: aSymbol [
self checkValidName: aSymbol.
Expand Down Expand Up @@ -89,32 +94,32 @@ Variable >> hash [
^ self species hash bitXor: self name hash
]

{ #category : #OCVARIABLE }
{ #category : #testing }
Variable >> isArg [
^false
]

{ #category : #OCVARIABLE }
{ #category : #testing }
Variable >> isClassVariable [
^ false
]

{ #category : #OCVARIABLE }
{ #category : #testing }
Variable >> isGlobal [
^false
]

{ #category : #OCVARIABLE }
{ #category : #testing }
Variable >> isGlobalVariable [
^ false
]

{ #category : #OCVARIABLE }
{ #category : #testing }
Variable >> isInstance [
^ false
]

{ #category : #OCVARIABLE }
{ #category : #testing }
Variable >> isLiteralVariable [
^false
]
Expand All @@ -124,56 +129,51 @@ Variable >> isReferenced [
^ self subclassResponsibility
]

{ #category : #OCVARIABLE }
Variable >> isRemote [
^false
]

{ #category : #OCVARIABLE }
{ #category : #testing }
Variable >> isSelf [
^false
]

{ #category : #OCVARIABLE }
{ #category : #testing }
Variable >> isSelfOrSuper [

^ false
]

{ #category : #OCVARIABLE }
{ #category : #testing }
Variable >> isSpecialVariable [
^false
]

{ #category : #OCVARIABLE }
{ #category : #testing }
Variable >> isSuper [
^false
]

{ #category : #OCVARIABLE }
{ #category : #testing }
Variable >> isTemp [

^ false
]

{ #category : #OCVARIABLE }
{ #category : #testing }
Variable >> isThisContext [
^false
]

{ #category : #OCVARIABLE }
{ #category : #testing }
Variable >> isUndeclared [

^ false
]

{ #category : #OCVARIABLE }
{ #category : #testing }
Variable >> isUninitialized [

^ false
]

{ #category : #OCVARIABLE }
{ #category : #testing }
Variable >> isWritable [
^ true
]
Expand Down
2 changes: 1 addition & 1 deletion src/OpalCompiler-Tests/OCASTClosureAnalyzerTest.class.st
Original file line number Diff line number Diff line change
Expand Up @@ -459,7 +459,7 @@ OCASTClosureAnalyzerTest >> testSingleRemoteTempVar [
self assert: (ast scope lookupVar: 'index') isRemote.
self assert: (ast scope lookupVar: 'index') definingScope equals: ast scope.
self deny: (ast scope lookupVar: 'block') isRemote.
self deny: (ast scope lookupVar: 'collection') isRemote
self deny: (ast scope lookupVar: 'theCollection') isRemote
]

{ #category : #'testing - variables' }
Expand Down

0 comments on commit 7544b03

Please sign in to comment.