-
Notifications
You must be signed in to change notification settings - Fork 4
Refactor: Clean up dead code and align copy with standard Pharo lifecycle #10
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from 2 commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -268,21 +268,6 @@ CTKeyedTree >> collect: aBlock [ | |
| ^ result | ||
| ] | ||
|
|
||
| { #category : 'copying' } | ||
| CTKeyedTree >> copy [ | ||
|
|
||
| "Answer a deep copy of the receiver including all subtrees." | ||
|
|
||
| | result | | ||
| result := self species new. | ||
| self keysAndValuesDo: [ :key :value | | ||
| result at: key put: ( | ||
| (value isKindOf: self class) | ||
| ifTrue: [ value copy ] | ||
| ifFalse: [ value ] ) ]. | ||
| ^ result | ||
| ] | ||
|
|
||
| { #category : 'accessing' } | ||
| CTKeyedTree >> depth [ | ||
|
|
||
|
|
@@ -496,16 +481,11 @@ CTKeyedTree >> pathsAndValuesDo: aBlock currentPath: pathArray [ | |
|
|
||
| { #category : 'copying' } | ||
| CTKeyedTree >> postCopy [ | ||
|
|
||
| "Ensure proper deep copying of associations and subtrees." | ||
|
|
||
| array := array collect: [ :assoc | | ||
| assoc ifNotNil: [ | ||
| Association | ||
| key: assoc key | ||
| value: ((assoc value isKindOf: self class) | ||
| ifTrue: [ assoc value copy ] | ||
| ifFalse: [ assoc value ]) ] ] | ||
| super postCopy. | ||
| self keysAndValuesDo: [ :key :value | | ||
| (value isKindOf: self class) | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. why do we need to type check in here?
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. You are right, i carried it over from the old dead ig we can fix that using Polymorphism by Just send |
||
| ifTrue: [ self at: key put: value copy ] ] | ||
| ] | ||
|
|
||
| { #category : 'printing' } | ||
|
|
||
Uh oh!
There was an error while loading. Please reload this page.