solidity icon indicating copy to clipboard operation
solidity copied to clipboard

Fix AttributeError in `insert_node_before`

Open Pricstas opened this issue 9 months ago • 1 comments

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) with child.parent.children.insert(position, new_sibling), ensuring proper insertion of nodes.

Pricstas avatar Mar 08 '25 15:03 Pricstas

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.

github-actions[bot] avatar Mar 08 '25 15:03 github-actions[bot]

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! 🙏

Pricstas avatar Aug 05 '25 19:08 Pricstas