pub struct TypeTracker { /* private fields */ }Expand description
Tracks variable types within the current analysis scope
Implementations§
Source§impl TypeTracker
impl TypeTracker
pub fn new() -> Self
Sourcepub fn with_registry(registry: Arc<GlobalTypeRegistry>) -> Self
pub fn with_registry(registry: Arc<GlobalTypeRegistry>) -> Self
Create a TypeTracker with a shared type registry
Sourcepub fn set_function_registry(
&mut self,
registry: Arc<FunctionSignatureRegistry>,
)
pub fn set_function_registry( &mut self, registry: Arc<FunctionSignatureRegistry>, )
Set the function registry for return type resolution
Sourcepub fn set_current_file(&mut self, file: PathBuf)
pub fn set_current_file(&mut self, file: PathBuf)
Set the current file path for import resolution
Sourcepub fn set_module_path(&mut self, path: Vec<String>)
pub fn set_module_path(&mut self, path: Vec<String>)
Set the module path
Sourcepub fn enter_scope(&mut self, kind: ScopeKind, impl_type: Option<String>)
pub fn enter_scope(&mut self, kind: ScopeKind, impl_type: Option<String>)
Enter a new scope
Sourcepub fn exit_scope(&mut self)
pub fn exit_scope(&mut self)
Exit the current scope
Sourcepub fn record_variable(&mut self, name: String, resolved_type: ResolvedType)
pub fn record_variable(&mut self, name: String, resolved_type: ResolvedType)
Record a variable with its type
Sourcepub fn resolve_variable_type(&self, name: &str) -> Option<ResolvedType>
pub fn resolve_variable_type(&self, name: &str) -> Option<ResolvedType>
Resolve a variable’s type by looking through the scope stack
Sourcepub fn resolve_expr_type(&self, expr: &Expr) -> Option<ResolvedType>
pub fn resolve_expr_type(&self, expr: &Expr) -> Option<ResolvedType>
Resolve the type of an expression
Sourcepub fn current_impl_type(&self) -> Option<String>
pub fn current_impl_type(&self) -> Option<String>
Get the current impl type if in an impl block
Sourcepub fn track_self_param(
&mut self,
fn_item: Option<&ItemFn>,
impl_fn: Option<&ImplItemFn>,
)
pub fn track_self_param( &mut self, fn_item: Option<&ItemFn>, impl_fn: Option<&ImplItemFn>, )
Track self parameter in a function
Trait Implementations§
Source§impl Clone for TypeTracker
impl Clone for TypeTracker
Source§fn clone(&self) -> TypeTracker
fn clone(&self) -> TypeTracker
Returns a duplicate of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl Debug for TypeTracker
impl Debug for TypeTracker
Auto Trait Implementations§
impl Freeze for TypeTracker
impl RefUnwindSafe for TypeTracker
impl Send for TypeTracker
impl Sync for TypeTracker
impl Unpin for TypeTracker
impl UnwindSafe for TypeTracker
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
Mutably borrows from an owned value. Read more
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
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>
Converts
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>
Converts
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