Files
sdk/pkg/analyzer/tool/generators
Konstantin Shcheglov 91448cc737 CQ. Generate removeChild() and replaceChild(), replacement for NodeReplacer.
Add generated support for removing and replacing AST children directly
on AST nodes. Each generated implementation now knows which of its child
slots can be updated, which required slots cannot be removed, and which
NodeList slots support replacement but not resizing.

Add shared helpers on AstNodeImpl for common mutation operations:

- removeFromParent(), for clearing a nullable child slot.
- replaceWith(), for replacing this node in its parent.
- replaceChild(), for replacing a specific child even when constructing the replacement has already moved children out of the old node.

This makes child mutation slot-aware and moves the behavior onto the
generated node implementations, providing a direct replacement path for
NodeReplacer while keeping invalid removals explicit.

Change-Id: Ic2a44561170206f6006df43879a09b4eebff8a63
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/499380
Reviewed-by: Johnni Winther <johnniwinther@google.com>
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
2026-04-30 08:12:25 -07:00
..