Make some of ruff_python_semantic pub(crate) (#5093)

This commit is contained in:
Charlie Marsh 2023-06-14 13:49:37 -04:00 committed by GitHub
parent 916f0889f8
commit c992cfa76e
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
5 changed files with 22 additions and 22 deletions

View file

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