TypeEnv

Struct TypeEnv 

Source
pub struct TypeEnv { /* private fields */ }

Implementations§

Source§

impl TypeEnv

Source

pub fn new() -> Self

Source

pub fn with_config(config: &LustConfig) -> Self

Source

pub fn is_builtin_type(&self, name: &str) -> bool

Source

pub fn push_scope(&mut self)

Source

pub fn pop_scope(&mut self)

Source

pub fn declare_variable(&mut self, name: String, ty: Type) -> Result<()>

Source

pub fn lookup_variable(&self, name: &str) -> Option<Type>

Source

pub fn refine_variable_type(&mut self, name: String, refined_type: Type)

Source

pub fn record_generic_instance( &mut self, var_name: String, type_param: String, concrete_type: Type, )

Source

pub fn lookup_generic_param( &self, var_name: &str, type_param: &str, ) -> Option<Type>

Source

pub fn register_function( &mut self, name: String, sig: FunctionSignature, ) -> Result<()>

Source

pub fn register_or_update_function( &mut self, name: String, sig: FunctionSignature, ) -> Result<()>

Source

pub fn lookup_function(&self, name: &str) -> Option<&FunctionSignature>

Source

pub fn function_signatures(&self) -> HashMap<String, FunctionSignature>

Source

pub fn struct_definitions(&self) -> HashMap<String, StructDef>

Source

pub fn enum_definitions(&self) -> HashMap<String, EnumDef>

Source

pub fn register_struct(&mut self, s: &StructDef) -> Result<()>

Source

pub fn lookup_struct(&self, name: &str) -> Option<&StructDef>

Source

pub fn register_enum(&mut self, e: &EnumDef) -> Result<()>

Source

pub fn lookup_enum(&self, name: &str) -> Option<&EnumDef>

Source

pub fn register_trait(&mut self, t: &TraitDef) -> Result<()>

Source

pub fn lookup_trait(&self, name: &str) -> Option<&TraitDef>

Source

pub fn register_type_alias( &mut self, name: String, type_params: Vec<String>, target: Type, ) -> Result<()>

Source

pub fn register_impl(&mut self, impl_block: &ImplBlock)

Source

pub fn lookup_method( &self, type_name: &str, method_name: &str, ) -> Option<&FunctionDef>

Source

pub fn lookup_struct_field( &self, struct_name: &str, field_name: &str, ) -> Option<Type>

Source

pub fn type_implements_trait(&self, ty: &Type, trait_name: &str) -> bool

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.