pub struct MatlabTypeChecker {
pub env: HashMap<String, MatlabType>,
pub errors: Vec<String>,
}Expand description
A basic type-consistency checker for MATLAB expressions.
Fields§
§env: HashMap<String, MatlabType>Variable type environment.
errors: Vec<String>Type errors collected.
Implementations§
Source§impl MatlabTypeChecker
impl MatlabTypeChecker
Sourcepub fn declare(&mut self, name: impl Into<String>, ty: MatlabType)
pub fn declare(&mut self, name: impl Into<String>, ty: MatlabType)
Declare a variable with a type.
Sourcepub fn infer(&self, expr: &MatlabExpr) -> MatlabType
pub fn infer(&self, expr: &MatlabExpr) -> MatlabType
Infer the type of a MATLAB expression.
Sourcepub fn check_stmt(&mut self, stmt: &MatlabStmt)
pub fn check_stmt(&mut self, stmt: &MatlabStmt)
Check a statement for type consistency.
Sourcepub fn has_errors(&self) -> bool
pub fn has_errors(&self) -> bool
Whether any errors were found.
Trait Implementations§
Auto Trait Implementations§
impl Freeze for MatlabTypeChecker
impl RefUnwindSafe for MatlabTypeChecker
impl Send for MatlabTypeChecker
impl Sync for MatlabTypeChecker
impl Unpin for MatlabTypeChecker
impl UnsafeUnpin for MatlabTypeChecker
impl UnwindSafe for MatlabTypeChecker
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