pub struct TypeChecker { /* private fields */ }Implementations§
Source§impl TypeChecker
impl TypeChecker
pub fn check_array_literal( &mut self, elements: &[Expr], expected_type: Option<&Type>, ) -> Result<Type>
pub fn check_map_literal( &mut self, entries: &[(Expr, Expr)], expected_type: Option<&Type>, ) -> Result<Type>
pub fn check_struct_literal( &mut self, span: Span, name: &str, fields: &[StructLiteralField], ) -> Result<Type>
pub fn check_lambda( &mut self, params: &[(String, Option<Type>)], return_type: Option<&Type>, body: &Expr, ) -> Result<Type>
pub fn check_if_expr( &mut self, condition: &Expr, then_branch: &Expr, else_branch: &Option<Box<Expr>>, ) -> Result<Type>
Source§impl TypeChecker
impl TypeChecker
Source§impl TypeChecker
impl TypeChecker
pub fn check_literal(&self, lit: &Literal) -> Result<Type>
pub fn check_binary_expr( &mut self, span: Span, left: &Expr, op: &BinaryOp, right: &Expr, ) -> Result<Type>
pub fn check_unary_expr(&mut self, op: &UnaryOp, operand: &Expr) -> Result<Type>
pub fn check_call_expr( &mut self, span: Span, callee: &Expr, args: &[Expr], ) -> Result<Type>
pub fn check_method_call( &mut self, receiver: &Expr, method: &str, args: &[Expr], ) -> Result<Type>
pub fn check_field_access_with_hint( &mut self, span: Span, object: &Expr, field: &str, expected_type: Option<&Type>, ) -> Result<Type>
pub fn check_index_expr(&mut self, object: &Expr, index: &Expr) -> Result<Type>
Source§impl TypeChecker
impl TypeChecker
pub fn validate_is_pattern( &mut self, pattern: &Pattern, scrutinee_type: &Type, ) -> Result<()>
pub fn extract_type_narrowings_from_expr( &mut self, expr: &Expr, ) -> Vec<(String, Type)>
pub fn extract_all_pattern_bindings_from_expr<'a>( &self, expr: &'a Expr, ) -> Vec<(&'a Expr, Pattern)>
pub fn bind_pattern( &mut self, pattern: &Pattern, scrutinee_type: &Type, ) -> Result<()>
Source§impl TypeChecker
impl TypeChecker
pub fn new() -> Self
pub fn with_config(config: &LustConfig) -> Self
pub fn check_module(&mut self, items: &[Item]) -> Result<()>
pub fn check_program(&mut self, modules: &[LoadedModule]) -> Result<()>
pub fn set_imports_by_module(&mut self, map: HashMap<String, ModuleImports>)
pub fn take_type_info(&mut self) -> TypeCollection
pub fn take_option_coercions(&mut self) -> HashMap<String, HashSet<Span>>
pub fn function_signatures(&self) -> HashMap<String, FunctionSignature>
pub fn struct_definitions(&self) -> HashMap<String, StructDef>
pub fn enum_definitions(&self) -> HashMap<String, EnumDef>
pub fn resolve_function_key(&self, name: &str) -> String
pub fn resolve_value_key(&self, name: &str) -> String
pub fn resolve_module_alias(&self, alias: &str) -> Option<String>
pub fn register_external_struct(&mut self, def: StructDef) -> Result<()>
pub fn register_external_enum(&mut self, def: EnumDef) -> Result<()>
pub fn register_external_trait(&mut self, def: TraitDef) -> Result<()>
pub fn register_external_function( &mut self, (name, signature): (String, FunctionSignature), ) -> Result<()>
pub fn register_external_constant( &mut self, name: String, ty: Type, ) -> Result<()>
pub fn register_external_impl(&mut self, impl_block: ImplBlock) -> Result<()>
pub fn resolve_type_key(&self, name: &str) -> String
pub fn canonicalize_type(&self, ty: &Type) -> Type
Auto Trait Implementations§
impl Freeze for TypeChecker
impl RefUnwindSafe for TypeChecker
impl Send for TypeChecker
impl Sync for TypeChecker
impl Unpin for TypeChecker
impl UnsafeUnpin for TypeChecker
impl UnwindSafe for TypeChecker
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