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 visit() function to source tree #121

Merged
merged 2 commits into from
Nov 5, 2024
Merged

Conversation

Pennycook
Copy link
Contributor

The new visit() function:

  • Passes each node as an argument to the specified callable.
  • Decides which node to visit next based on the return type.

The return types are an enum; the values in this enum may need to be extended in order to support additional functionality.

Related issues

Part of #101. visit() will be used to implement replacements for the remaining classes from the walkers/ module.

Proposed changes

  • Add visit() functions to Node and SourceTree, which invoke the specified callable.
  • Add tests for different visitor types, including validation tests.
  • Add tests for Visit.NEXT and Visit.NEXT_SIBLING behavior.

The new visit() function:
- Passes each node as an argument to the specified callable.
- Decides which node to visit next based on the return type.

The return types are an enum; the values in this enum may need to be
extended in order to support additional functionality.

Signed-off-by: John Pennycook <[email protected]>
@Pennycook Pennycook added the enhancement New feature or request label Oct 10, 2024
@Pennycook Pennycook added this to the 2.0.0 milestone Oct 10, 2024
codebasin/preprocessor.py Outdated Show resolved Hide resolved
@Pennycook
Copy link
Contributor Author

The failing tests are unrelated to these changes and are caused by #120.

@Pennycook Pennycook merged commit 29e7c77 into intel:main Nov 5, 2024
2 of 3 checks passed
@Pennycook Pennycook deleted the tree-visit branch November 5, 2024 09:49
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants