Skip to content
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

Add isChildOptional() method #1070

Merged
merged 1 commit into from
Jul 22, 2024

Conversation

sgizler
Copy link
Contributor

@sgizler sgizler commented Jul 22, 2024

Add method for determining whether child at given index is wrapped in not_null<>.

Rationale:
Passing child that is wrapped in not_null to SyntaxRewriter::remove(), results in failing not_null assertion.
When you remove quite a lot arbitrary nodes it gets cumbersome to avoid this issue "manually".

Thanks to this isChildOptional(), one can re-implement visit/visitDefault methods to pass handler information that node must not be removed.

@sgizler sgizler marked this pull request as draft July 22, 2024 13:33
Copy link

codecov bot commented Jul 22, 2024

Codecov Report

Attention: Patch coverage is 0% with 3 lines in your changes missing coverage. Please review.

Project coverage is 94.71%. Comparing base (d3982ef) to head (e2bf8e8).

Additional details and impacted files

Impacted file tree graph

@@            Coverage Diff             @@
##           master    #1070      +/-   ##
==========================================
- Coverage   94.72%   94.71%   -0.01%     
==========================================
  Files         191      191              
  Lines       47671    47674       +3     
==========================================
  Hits        45154    45154              
- Misses       2517     2520       +3     
Files Coverage Δ
include/slang/syntax/SyntaxNode.h 82.25% <ø> (ø)
source/syntax/SyntaxNode.cpp 61.60% <0.00%> (-1.70%) ⬇️

Continue to review full report in Codecov by Sentry.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update d3982ef...e2bf8e8. Read the comment docs.

Add method for determining whether child at given index is wrapped in not_null<>.

Rationale:
Passing child that is wrapped in not_null to SyntaxRewriter::remove(),
results in failing not_null assertion. When you remove quite a lot
arbitrary nodes it gets cumbersome to avoid this issue "manually".

Thanks to this isChildOptional(), one can re-implement
visit/visitDefault methods to pass handler information that
node must not be removed.
@sgizler sgizler marked this pull request as ready for review July 22, 2024 14:41
@MikePopoloski MikePopoloski merged commit 928045a into MikePopoloski:master Jul 22, 2024
15 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants