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:
Dhruv Manilawala 2024-02-13 00:47:12 +05:30 committed by GitHub
parent edfe8421ec
commit 3f4dd01e7a
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
2 changed files with 13 additions and 10 deletions

View file

@ -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.
///