pub struct TypeContext<'a> {
pub expected_type: Option<&'a Type>,
pub return_type: Option<&'a Type>,
pub scope: TypeContextScope,
pub is_in_compare_like: bool,
}
Expand description
Type checking context
Fields§
§expected_type: Option<&'a Type>
Expected type for the current expression
return_type: Option<&'a Type>
Return type of the enclosing function
scope: TypeContextScope
§is_in_compare_like: bool
Implementations§
Source§impl<'a> TypeContext<'a>
impl<'a> TypeContext<'a>
pub const fn new( expected_type: Option<&'a Type>, return_type: Option<&'a Type>, scope: TypeContextScope, ) -> Self
pub const fn new_argument(required_type: &'a Type) -> Self
pub const fn new_unsure_argument(expected_type: Option<&'a Type>) -> Self
pub const fn new_anything_argument() -> Self
pub const fn new_function(required_type: &'a Type) -> Self
pub const fn with_expected_type(&self, expected_type: Option<&'a Type>) -> Self
Sourcepub const fn for_return(&self) -> Self
pub const fn for_return(&self) -> Self
§Panics
pub fn enter_function(&self, required_type: &'a Type) -> Self
Sourcepub fn enter_loop(&self) -> Self
pub fn enter_loop(&self) -> Self
Creates a new scope when entering a loop
Sourcepub fn enter_compare(&self) -> Self
pub fn enter_compare(&self) -> Self
Creates a new scope when entering a loop
Trait Implementations§
Source§impl<'a> Clone for TypeContext<'a>
impl<'a> Clone for TypeContext<'a>
Source§fn clone(&self) -> TypeContext<'a>
fn clone(&self) -> TypeContext<'a>
Returns a copy 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 moreAuto Trait Implementations§
impl<'a> Freeze for TypeContext<'a>
impl<'a> !RefUnwindSafe for TypeContext<'a>
impl<'a> !Send for TypeContext<'a>
impl<'a> !Sync for TypeContext<'a>
impl<'a> Unpin for TypeContext<'a>
impl<'a> !UnwindSafe for TypeContext<'a>
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