Skip to content

Commit

Permalink
#asRedefinedInstance instead of #copy to keep original instance of an…
Browse files Browse the repository at this point in the history
…notation when it is redefined
  • Loading branch information
dionisiydk committed Mar 2, 2018
1 parent 636ae82 commit a7d4c4d
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ redefineInstance: aClassAnnotation by: aBlock
| redefined |
redefinedInstances ifNil: [ redefinedInstances := Dictionary new ].

redefined := redefinedInstances removeKey: aClassAnnotation ifAbsent: [ aClassAnnotation copy ].
redefined := redefinedInstances
removeKey: aClassAnnotation ifAbsent: [ aClassAnnotation asRedefinedInstance ].
redefinedInstances at: aClassAnnotation put: redefined.
aBlock cull: aClassAnnotation
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
redefining
asRedefinedInstance
"it is a hook method to allow subclasses copy extra state if needed
to keep redefined instance in safe"
^self copy

0 comments on commit a7d4c4d

Please sign in to comment.