mirror of
https://github.com/astral-sh/ruff.git
synced 2025-08-17 17:10:53 +00:00
Add a convenience method to check if a name is bound (#4718)
This commit is contained in:
parent
1846d90bbd
commit
80fa3f2bfa
3 changed files with 16 additions and 18 deletions
|
@ -123,6 +123,12 @@ impl<'a> SemanticModel<'a> {
|
|||
.map_or(false, |binding| binding.kind.is_builtin())
|
||||
}
|
||||
|
||||
/// Return `true` if `member` is unbound.
|
||||
pub fn is_unbound(&self, member: &str) -> bool {
|
||||
self.find_binding(member)
|
||||
.map_or(true, |binding| binding.kind.is_builtin())
|
||||
}
|
||||
|
||||
/// Resolve a reference to the given symbol.
|
||||
pub fn resolve_reference(&mut self, symbol: &str, range: TextRange) -> ResolvedReference {
|
||||
// PEP 563 indicates that if a forward reference can be resolved in the module scope, we
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue