Skip to content

Commit

Permalink
Deprecate #numberOfInstanceVariables since it's a duplicated of #inst…
Browse files Browse the repository at this point in the history
…Size.
  • Loading branch information
jecisc committed Nov 5, 2019
1 parent f680827 commit e2cd188
Show file tree
Hide file tree
Showing 5 changed files with 17 additions and 16 deletions.
7 changes: 7 additions & 0 deletions src/Deprecated80/Behavior.extension.st
@@ -0,0 +1,7 @@
Extension { #name : #Behavior }

{ #category : #'*Deprecated80' }
Behavior >> numberOfInstanceVariables [
self deprecated: 'Use #instSize or `slots size` instead.' transformWith: '`@receiver numberOfInstanceVariables' -> '`@receiver instSize'.
^ self instSize
]
14 changes: 7 additions & 7 deletions src/Kernel-Tests/BehaviorTest.class.st
Expand Up @@ -110,6 +110,13 @@ BehaviorTest >> testIncludesMethod [
self deny: (LookupKey includesMethod: Point>>#x).
]

{ #category : #metrics }
BehaviorTest >> testInstSize [
self assert: Object instSize equals: 0.
self assert: Point instSize equals: 2.
self assert: Metaclass instSize equals: 1
]

{ #category : #tests }
BehaviorTest >> testIsAbstract [

Expand Down Expand Up @@ -179,13 +186,6 @@ BehaviorTest >> testMethodsWritingSlot [
self assert: numberViaSlot = numberViaIVar.
]

{ #category : #metrics }
BehaviorTest >> testNumberOfInstanceVariables [
self assert: Object numberOfInstanceVariables equals: 0.
self assert: Point numberOfInstanceVariables equals: 2.
self assert: Metaclass numberOfInstanceVariables equals: 1
]

{ #category : #'tests - properties' }
BehaviorTest >> testPropertyValueAtPut [
| testValue |
Expand Down
6 changes: 0 additions & 6 deletions src/Kernel/Behavior.class.st
Expand Up @@ -1359,12 +1359,6 @@ Behavior >> nonObsoleteClass [
^ self environment at: obsName asSymbol
]

{ #category : #accessing }
Behavior >> numberOfInstanceVariables [
^ self instVarNames size

]

{ #category : #initialization }
Behavior >> obsolete [
"nothing to be done"
Expand Down
Expand Up @@ -72,7 +72,7 @@ FTExampleClassInfoTableDataSource >> nameColumn: column row: rowIndex [
{ #category : #accessing }
FTExampleClassInfoTableDataSource >> numberOfInstanceVariablesColumn: column row: rowIndex [
^ FTCellMorph new
addMorph: (self elementAt: rowIndex) numberOfInstanceVariables asStringMorph;
addMorph: (self elementAt: rowIndex) instSize asStringMorph;
yourself
]

Expand Down
4 changes: 2 additions & 2 deletions src/Morphic-Widgets-FastTable/FTExamples.class.st
Expand Up @@ -611,7 +611,7 @@ FTExamples class >> exampleSortableTable2 [
yourself);
addColumn:
((FTColumn id: 'Number of instance variables')
sortableOnProperty: #numberOfInstanceVariables;
sortableOnProperty: #instSize;
yourself);
dataSource: FTExampleClassInfoTableDataSource new;
selectFirst;
Expand Down Expand Up @@ -645,7 +645,7 @@ FTExamples class >> exampleSortableTable3 [
yourself);
addColumn:
((FTColumn id: 'Number of instance variables')
sortableUsing: #numberOfInstanceVariables ascending , #name ascending; "Sort by number of inst var, if the same, sort by name."
sortableUsing: #instSize ascending , #name ascending; "Sort by number of inst var, if the same, sort by name."
yourself);
dataSource: FTExampleClassInfoTableDataSource new;
selectFirst;
Expand Down

0 comments on commit e2cd188

Please sign in to comment.