mirror of
https://github.com/astral-sh/ruff.git
synced 2025-08-22 03:15:44 +00:00
Rename semantic model flag to MODULE_DOCSTRING_BOUNDARY
(#9959)
## Summary This PR renames the semantic model flag `MODULE_DOCSTRING` to `MODULE_DOCSTRING_BOUNDARY`. The main reason is for readability and for the new semantic model flag `DOCSTRING` which tracks that the model is in a module / class / function docstring. I got confused earlier with the name until I looked at the use case and it seems that the `_BOUNDARY` prefix is more appropriate for the use-case and is consistent with other flags.
This commit is contained in:
parent
edfe8421ec
commit
3f4dd01e7a
2 changed files with 13 additions and 10 deletions
|
@ -1499,6 +1499,12 @@ impl<'a> SemanticModel<'a> {
|
|||
self.flags.intersects(SemanticModelFlags::FUTURES_BOUNDARY)
|
||||
}
|
||||
|
||||
/// Return `true` if the model has traversed past the module docstring boundary.
|
||||
pub const fn seen_module_docstring_boundary(&self) -> bool {
|
||||
self.flags
|
||||
.intersects(SemanticModelFlags::MODULE_DOCSTRING_BOUNDARY)
|
||||
}
|
||||
|
||||
/// Return `true` if `__future__`-style type annotations are enabled.
|
||||
pub const fn future_annotations(&self) -> bool {
|
||||
self.flags
|
||||
|
@ -1807,7 +1813,7 @@ bitflags! {
|
|||
///
|
||||
/// x: int = 1
|
||||
/// ```
|
||||
const MODULE_DOCSTRING = 1 << 16;
|
||||
const MODULE_DOCSTRING_BOUNDARY = 1 << 16;
|
||||
|
||||
/// The model is in a type parameter definition.
|
||||
///
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue