tinymist_analysis::ty

Trait TyCtxMut

Source
pub trait TyCtxMut: TyCtx {
    type Snap;

    // Required methods
    fn start_scope(&mut self) -> Self::Snap;
    fn end_scope(&mut self, snap: Self::Snap);
    fn bind_local(&mut self, var: &Interned<TypeVar>, ty: Ty);
    fn type_of_func(&mut self, func: &Func) -> Option<Interned<SigTy>>;
    fn type_of_value(&mut self, val: &Value) -> Ty;
    fn check_module_item(
        &mut self,
        module: FileId,
        key: &Interned<str>,
    ) -> Option<Ty>;

    // Provided methods
    fn with_scope<R>(&mut self, f: impl FnOnce(&mut Self) -> R) -> R { ... }
    fn type_of_dict(&mut self, dict: &Dict) -> Interned<RecordTy> { ... }
    fn type_of_module(&mut self, module: &Module) -> Interned<RecordTy> { ... }
}
Expand description

A mutable type context.

Required Associated Types§

Source

type Snap

The type of a snapshot of the scope.

Required Methods§

Source

fn start_scope(&mut self) -> Self::Snap

Start a new scope.

Source

fn end_scope(&mut self, snap: Self::Snap)

End the current scope.

Source

fn bind_local(&mut self, var: &Interned<TypeVar>, ty: Ty)

Bind a variable locally.

Source

fn type_of_func(&mut self, func: &Func) -> Option<Interned<SigTy>>

Get the type of a runtime function.

Source

fn type_of_value(&mut self, val: &Value) -> Ty

Get the type of a runtime value.

Source

fn check_module_item( &mut self, module: FileId, key: &Interned<str>, ) -> Option<Ty>

Check a module item.

Provided Methods§

Source

fn with_scope<R>(&mut self, f: impl FnOnce(&mut Self) -> R) -> R

Execute a function with a new scope.

Source

fn type_of_dict(&mut self, dict: &Dict) -> Interned<RecordTy>

Get the type of a runtime dict.

Source

fn type_of_module(&mut self, module: &Module) -> Interned<RecordTy>

Get the type of a runtime module.

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.

Implementors§