pub struct SymbolTable {Show 29 fields
pub name: Name,
pub typ: CompilerScope,
pub line_number: u32,
pub block_index: usize,
pub is_nested: bool,
pub is_method: bool,
pub symbols: IndexMap<Name, Symbol, RandomState<rapidhash::::quality::RandomState::{constant#0}, rapidhash::::quality::RandomState::{constant#1}, rapidhash::::quality::RandomState::{constant#2}, rapidhash::::quality::RandomState::{constant#3}>>,
pub sub_tables: Vec<SymbolTable>,
pub hidden_annotation_blocks: Vec<SymbolTable>,
pub next_hidden_annotation_block: usize,
pub inlined_comprehension_blocks: Vec<SymbolTable>,
pub next_inlined_comprehension_block: usize,
pub next_sub_table: usize,
pub varnames: Vec<Name>,
pub needs_class_closure: bool,
pub needs_classdict: bool,
pub can_see_class_scope: bool,
pub is_generator: bool,
pub is_coroutine: bool,
pub returns_value: bool,
pub annotations_used: bool,
pub scope_info: Option<&'static str>,
pub in_unevaluated_annotation: bool,
pub comp_inlined: bool,
pub annotation_block: Option<Box<SymbolTable>>,
pub skip_enclosing_function_scope: bool,
pub has_conditional_annotations: bool,
pub future_annotations: bool,
pub mangled_names: Option<IndexSet<Name, RandomState<rapidhash::::quality::RandomState::{constant#0}, rapidhash::::quality::RandomState::{constant#1}, rapidhash::::quality::RandomState::{constant#2}, rapidhash::::quality::RandomState::{constant#3}>>>,
}Expand description
Captures all symbols in the current scope, and has a list of sub-scopes in this scope.
Fields§
§name: NameThe name of this symbol table. Often the name of the class or function.
typ: CompilerScopeThe type of symbol table
line_number: u32The line number in the source code where this symboltable begins.
block_index: usizeMonotonic creation order used by public symtable children.
is_nested: bool§is_method: boolWhether this function-like scope was created directly in a class block.
symbols: IndexMap<Name, Symbol, RandomState<rapidhash::::quality::RandomState::{constant#0}, rapidhash::::quality::RandomState::{constant#1}, rapidhash::::quality::RandomState::{constant#2}, rapidhash::::quality::RandomState::{constant#3}>>A set of symbols present on this scope level.
sub_tables: Vec<SymbolTable>A list of sub-scopes in the order as found in the AST nodes.
Annotation scopes registered in st_blocks but not added to ste_children, e.g. future-annotation function signatures.
Cursor pointing to the next hidden annotation block to consume.
inlined_comprehension_blocks: Vec<SymbolTable>Inlined comprehension scopes removed from ste_children but can still find through st_blocks keyed by the comprehension expression.
next_inlined_comprehension_block: usizeCursor pointing to the next inlined comprehension block to consume.
next_sub_table: usizeCursor pointing to the next sub-table to consume during compilation.
varnames: Vec<Name>Variable names in definition order (parameters first, then locals)
needs_class_closure: boolWhether this class scope needs an implicit class cell
needs_classdict: boolWhether this class scope needs an implicit classdict cell
can_see_class_scope: boolWhether this type param scope can see the parent class scope
is_generator: boolWhether this scope contains yield/yield from (is a generator function)
is_coroutine: boolWhether this scope contains await or async comprehension machinery.
returns_value: boolWhether this scope contains a return statement with a value.
annotations_used: boolWhether this block visited at least one annotation expression.
scope_info: Option<&'static str>Optional description of the current type-variable evaluator context.
in_unevaluated_annotation: boolWhether this annotation block is currently visiting an unevaluated function-local annotation.
comp_inlined: boolWhether this comprehension scope should be inlined (PEP 709) True for list/set/dict comprehensions in non-generator expressions
annotation_block: Option<Box<SymbolTable>>PEP 649: Reference to annotation scope for this block
Annotations are compiled as a separate __annotate__ function
skip_enclosing_function_scope: boolTrue only for deferred function/class/module annotation scopes that should resolve outer names as if they were siblings of the owning function body, matching PEP 649 lookup rules.
has_conditional_annotations: boolPEP 649: Whether this scope has conditional annotations (annotations inside if/for/while/etc. blocks or at module level)
future_annotations: boolWhether from __future__ import annotations is active
mangled_names: Option<IndexSet<Name, RandomState<rapidhash::::quality::RandomState::{constant#0}, rapidhash::::quality::RandomState::{constant#1}, rapidhash::::quality::RandomState::{constant#2}, rapidhash::::quality::RandomState::{constant#3}>>>Names of type parameters that should still be mangled in type param scopes. When Some, only names in this set are mangled; other names are left unmangled. Set on type param blocks for generic classes; inherited by non-class child scopes.
Implementations§
Source§impl SymbolTable
impl SymbolTable
pub fn scan_program( program: &ModModule, source_file: SourceFile, ) -> Result<SymbolTable, SymbolTableError>
pub fn scan_program_with_options( program: &ModModule, source_file: SourceFile, allow_top_level_await: bool, future_annotations: bool, recursion_limit: usize, ) -> Result<SymbolTable, SymbolTableError>
pub fn scan_expr( expr: &ModExpression, source_file: SourceFile, ) -> Result<SymbolTable, SymbolTableError>
pub fn scan_expr_with_options( expr: &ModExpression, source_file: SourceFile, allow_top_level_await: bool, future_annotations: bool, recursion_limit: usize, ) -> Result<SymbolTable, SymbolTableError>
pub fn lookup(&self, name: &Name) -> Option<&Symbol>
Trait Implementations§
Source§impl Clone for SymbolTable
impl Clone for SymbolTable
Source§fn clone(&self) -> SymbolTable
fn clone(&self) -> SymbolTable
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreAuto Trait Implementations§
impl Freeze for SymbolTable
impl RefUnwindSafe for SymbolTable
impl Send for SymbolTable
impl Sync for SymbolTable
impl Unpin for SymbolTable
impl UnsafeUnpin for SymbolTable
impl UnwindSafe for SymbolTable
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> ErasedDestructor for Twhere
T: 'static,
impl<T> Helper for T
Source§impl<T, U> ImaginaryInto<U> for Twhere
U: ImaginaryFrom<T>,
impl<T, U> ImaginaryInto<U> for Twhere
U: ImaginaryFrom<T>,
fn imaginary_into(self) -> U
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more