mirror of
https://github.com/astral-sh/ruff.git
synced 2025-09-27 20:42:10 +00:00
Make some of ruff_python_semantic
pub(crate)
(#5093)
This commit is contained in:
parent
916f0889f8
commit
c992cfa76e
5 changed files with 22 additions and 22 deletions
|
@ -124,12 +124,12 @@ impl<'a> Scope<'a> {
|
|||
}
|
||||
|
||||
/// Set the globals pointer for this scope.
|
||||
pub fn set_globals_id(&mut self, globals: GlobalsId) {
|
||||
pub(crate) fn set_globals_id(&mut self, globals: GlobalsId) {
|
||||
self.globals_id = Some(globals);
|
||||
}
|
||||
|
||||
/// Returns the globals pointer for this scope.
|
||||
pub fn globals_id(&self) -> Option<GlobalsId> {
|
||||
pub(crate) fn globals_id(&self) -> Option<GlobalsId> {
|
||||
self.globals_id
|
||||
}
|
||||
|
||||
|
@ -196,17 +196,17 @@ pub struct Scopes<'a>(IndexVec<ScopeId, Scope<'a>>);
|
|||
|
||||
impl<'a> Scopes<'a> {
|
||||
/// Returns a reference to the global scope
|
||||
pub fn global(&self) -> &Scope<'a> {
|
||||
pub(crate) fn global(&self) -> &Scope<'a> {
|
||||
&self[ScopeId::global()]
|
||||
}
|
||||
|
||||
/// Returns a mutable reference to the global scope
|
||||
pub fn global_mut(&mut self) -> &mut Scope<'a> {
|
||||
pub(crate) fn global_mut(&mut self) -> &mut Scope<'a> {
|
||||
&mut self[ScopeId::global()]
|
||||
}
|
||||
|
||||
/// Pushes a new scope and returns its unique id
|
||||
pub fn push_scope(&mut self, kind: ScopeKind<'a>, parent: ScopeId) -> ScopeId {
|
||||
pub(crate) fn push_scope(&mut self, kind: ScopeKind<'a>, parent: ScopeId) -> ScopeId {
|
||||
let next_id = ScopeId::new(self.0.len());
|
||||
self.0.push(Scope::local(kind, parent));
|
||||
next_id
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue