Introduce a ruff_python_semantic
crate
#3865
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Summary
This PR moves the following modules into a new
ruff_python_semantic
crate, to separate non-semantic AST responsibilities (call_path.rs
,newlines.rs
, etc.) from the semantic model, which will be captured in this crate:binding.rs
scope.rs
context.rs
There are a few additional modules that were in
ruff_python_ast
and depend onContext
, but aren't part of the "semantic model" per se. For example,visibility.rs
determines the visibility (public, private) of a given binding, and also has utilities for checking whether the declaration is abstract, static, etc. None of this is captured by the AST, so it requires semantic analysis. For now, I included these underruff_python_semantic::analyze
.