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

Move ParenthesizedExpr to ruff_python_parser #8987

Merged
merged 1 commit into from
Dec 4, 2023

Conversation

MichaReiser
Copy link
Member

Summary

ParenthesizedExpr is some parser internal hack to make WithItem parsing possible. ParenthesizedExpr isn't part of our public AST.

That's why this PR moves ParenthesizedExpr into the ruff_python_parser crate with pub(super) visibility.

Test Plan

cargo test

@MichaReiser
Copy link
Member Author

Current dependencies on/for this PR:

This stack of pull requests is managed by Graphite.

@MichaReiser MichaReiser added the internal An internal refactor or improvement label Dec 4, 2023
impl ParenthesizedExpr {
/// Returns `true` if the expression is parenthesized.
pub(super) fn is_parenthesized(&self) -> bool {
self.range.start() != self.expr.range().start()
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I changed the condition here to only test the start as this should be sufficient

@MichaReiser MichaReiser force-pushed the move-parenthesized-expression branch from 9cd3834 to 2084d5a Compare December 4, 2023 05:21
@MichaReiser MichaReiser merged commit 7e390d3 into main Dec 4, 2023
17 checks passed
@MichaReiser MichaReiser deleted the move-parenthesized-expression branch December 4, 2023 05:36
Copy link
Contributor

github-actions bot commented Dec 4, 2023

ruff-ecosystem results

Linter (stable)

✅ ecosystem check detected no linter changes.

Linter (preview)

✅ ecosystem check detected no linter changes.

Formatter (stable)

✅ ecosystem check detected no format changes.

Formatter (preview)

✅ ecosystem check detected no format changes.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
internal An internal refactor or improvement
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants