Skip to content

Commit

Permalink
Fix protocol of Behavior>>#instSize and remove useless check that Obj…
Browse files Browse the repository at this point in the history
…ect has no instance variables.
  • Loading branch information
jecisc committed Nov 5, 2019
1 parent 20614df commit f680827
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 22 deletions.
2 changes: 1 addition & 1 deletion src/Kernel/Behavior.class.st
Expand Up @@ -942,7 +942,7 @@ Behavior >> initializeSlots: anObject [
self classLayout initializeInstance: anObject
]

{ #category : #testing }
{ #category : #'accessing instances and variables' }
Behavior >> instSize [
"Answer the number of named instance variables
(as opposed to indexed variables) of the receiver.
Expand Down
28 changes: 7 additions & 21 deletions src/Kernel/DeepCopier.class.st
Expand Up @@ -69,36 +69,22 @@ DeepCopier >> basicCheckClass: aClass [
DeepCopier >> checkAllClasses [

| warnings |
self checkBasicClasses.

warnings := ((self systemNavigation allClassesImplementing: #veryDeepInner:),
(self systemNavigation allClassesImplementing: #veryDeepCopyWith:)) flatCollect: [ :aClass |
self basicCheckClass: aClass ].

self raiseWarningsIfAny: warnings
]

{ #category : #checking }
DeepCopier >> checkBasicClasses [
"Check that no indexes of instance vars have changed in certain classes. If you get an error in this method, an implementation of veryDeepCopyWith: needs to be updated. The idea is to catch a change while it is still in the system of the programmer who made it.
DeepCopier new checkAllClasses"
Object instSize = 0 ifFalse: [ self error: 'Many implementers of veryDeepCopyWith: are out of date' ].



]

{ #category : #checking }
DeepCopier >> checkClass: aClass [

| warnings |
self checkBasicClasses.
warnings := self basicCheckClass: aClass.
warnings ifNotEmpty: [
Warning new
messageText: 'VeryDeepCopy out of sync in some classes. Some classes contain veryDeepCopyWith: or veryDeepInner: methods that are not in sync with their instance variables. Check the exception #tag for a list of them';
tag: warnings;
signal ]
(self basicCheckClass: aClass)
ifNotEmpty: [ :warnings |
Warning new
messageText:
'VeryDeepCopy out of sync in some classes. Some classes contain veryDeepCopyWith: or veryDeepInner: methods that are not in sync with their instance variables. Check the exception #tag for a list of them';
tag: warnings;
signal ]
]

{ #category : #'like fullCopy' }
Expand Down

0 comments on commit f680827

Please sign in to comment.