Fix AttributeError in `insert_node_before`
This PR fixes a bug in insert_node_before where child.parent.insert(position, new_sibling) was incorrectly used.
Since docutils.nodes.Element does not have an insert method, the correct approach is to insert the new sibling into the children list instead.
Changes
- Replaced
child.parent.insert(position, new_sibling)withchild.parent.children.insert(position, new_sibling), ensuring proper insertion of nodes.
Thank you for your contribution to the Solidity compiler! A team member will follow up shortly.
If you haven't read our contributing guidelines and our review checklist before, please do it now, this makes the reviewing process and accepting your contribution smoother.
If you have any questions or need our help, feel free to post them in the PR or talk to us directly on the #solidity-dev channel on Matrix.
Hi @solidity-dev team!
Just a friendly reminder about PR #15913: it fixes an AttributeError in insert_node_before by replacing:
child.parent.insert(position, new_sibling)
with
child.parent.children.insert(position, new_sibling)
This ensures proper insertion of nodes under docutils.nodes.Element. All checks have passed and it can be merged cleanly. Could someone please take a look and approve when you have a moment? Thanks! 🙏