diff --git a/src/Deprecated80/Behavior.extension.st b/src/Deprecated80/Behavior.extension.st new file mode 100644 index 00000000000..bb5431c77fc --- /dev/null +++ b/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 +] diff --git a/src/Kernel-Tests/BehaviorTest.class.st b/src/Kernel-Tests/BehaviorTest.class.st index 440563c473d..2d29f2e0861 100644 --- a/src/Kernel-Tests/BehaviorTest.class.st +++ b/src/Kernel-Tests/BehaviorTest.class.st @@ -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 [ @@ -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 | diff --git a/src/Kernel/Behavior.class.st b/src/Kernel/Behavior.class.st index e4cb4724d5f..2a0aaf7e8d5 100644 --- a/src/Kernel/Behavior.class.st +++ b/src/Kernel/Behavior.class.st @@ -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" diff --git a/src/Morphic-Widgets-FastTable/FTExampleClassInfoTableDataSource.class.st b/src/Morphic-Widgets-FastTable/FTExampleClassInfoTableDataSource.class.st index 757d706e5a3..c85775db30a 100644 --- a/src/Morphic-Widgets-FastTable/FTExampleClassInfoTableDataSource.class.st +++ b/src/Morphic-Widgets-FastTable/FTExampleClassInfoTableDataSource.class.st @@ -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 ] diff --git a/src/Morphic-Widgets-FastTable/FTExamples.class.st b/src/Morphic-Widgets-FastTable/FTExamples.class.st index cb82a708d36..f5962618f2a 100644 --- a/src/Morphic-Widgets-FastTable/FTExamples.class.st +++ b/src/Morphic-Widgets-FastTable/FTExamples.class.st @@ -611,7 +611,7 @@ FTExamples class >> exampleSortableTable2 [ yourself); addColumn: ((FTColumn id: 'Number of instance variables') - sortableOnProperty: #numberOfInstanceVariables; + sortableOnProperty: #instSize; yourself); dataSource: FTExampleClassInfoTableDataSource new; selectFirst; @@ -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;