mirror of
https://github.com/astral-sh/ruff.git
synced 2025-08-21 19:05:09 +00:00
red-knot: move symbol lookups in symbol.rs
(#16152)
## Summary This PR does the following: * Moves the following from `types.rs` in `symbol.rs`: * `symbol` * `global_symbol` * `imported_symbol` * `symbol_from_bindings` * `symbol_from_declarations` * `SymbolAndQualifiers` * `SymbolFromDeclarationsResult` * Moves the following from `stdlib.rs` in `symbol.rs` and removes `stdlib.rs`: * `known_module_symbol` * `builtins_symbol` * `typing_symbol` (only for tests) * `typing_extensions_symbol` * `builtins_module_scope` * `core_module_scope` * Add `symbol_from_bindings_impl` and `symbol_from_declarations_impl` to keep `RequiresExplicitReExport` an implementation detail * Make `declaration_type` a `pub(crate)` as it's required in `symbol_from_declarations` (`binding_type` is already `pub(crate)` The main motivation is to keep the implementation details private and only expose an ergonomic API which uses sane defaults for various scenario to avoid any mistakes from the caller. Refer to https://github.com/astral-sh/ruff/pull/16133#discussion_r1955262772, https://github.com/astral-sh/ruff/pull/16133#issue-2850146612 for details.
This commit is contained in:
parent
9304fdf4ec
commit
9f111eaebf
6 changed files with 663 additions and 623 deletions
|
@ -22,7 +22,6 @@ mod python_platform;
|
|||
pub mod semantic_index;
|
||||
mod semantic_model;
|
||||
pub(crate) mod site_packages;
|
||||
mod stdlib;
|
||||
mod suppression;
|
||||
pub(crate) mod symbol;
|
||||
pub mod types;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue