Skip to content

Add AttributeBag.CloneAttributes - #29

Merged
TomasVotruba merged 2 commits into
rectorphp:mainfrom
danslo:attribute-bag-clone
Nov 23, 2026
Merged

TomasVotruba merged 2 commits into
rectorphp:mainfrom
danslo:attribute-bag-clone

Conversation

@danslo

@danslo danslo commented Nov 18, 2026

Copy link
Copy Markdown
Contributor

A node copied by value keeps the same attribute map as the original, so setting an attribute on the copy changed the original too. Clone returns a bag with its own copy of the map, for code that deep-copies nodes. Added a test.

@TomasVotruba
TomasVotruba force-pushed the attribute-bag-clone branch 4 times, most recently from 56b6621 to 84ef362 Compare November 23, 2026 06:49
@TomasVotruba TomasVotruba changed the title Add AttributeBag.Clone Add AttributeBag.CloneAttributes Nov 23, 2026
@TomasVotruba
TomasVotruba force-pushed the attribute-bag-clone branch 2 times, most recently from a8fad05 to e35826d Compare November 23, 2026 07:03
danslo and others added 2 commits November 23, 2026 08:04
A copied node shares its attribute map with the original unless the bag is cloned, so setting an attribute on the copy changed the original.
@TomasVotruba
TomasVotruba merged commit 3ae55ef into rectorphp:main Nov 23, 2026
5 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Development

Successfully merging this pull request may close these issues.

2 participants