feat(Type): add is_option method
This commit is contained in:
parent
8393d8555c
commit
11c793dd2a
|
@ -135,6 +135,14 @@ impl Type {
|
|||
}
|
||||
}
|
||||
|
||||
pub fn is_option(&self) -> bool {
|
||||
match self {
|
||||
Self::App { module, name, .. } if "Option" == name && module.is_empty() => true,
|
||||
Self::Var { tipo } => tipo.borrow().is_option(),
|
||||
_ => false,
|
||||
}
|
||||
}
|
||||
|
||||
pub fn is_map(&self) -> bool {
|
||||
match self {
|
||||
Self::App {
|
||||
|
@ -416,6 +424,13 @@ impl TypeVar {
|
|||
}
|
||||
}
|
||||
|
||||
pub fn is_option(&self) -> bool {
|
||||
match self {
|
||||
Self::Link { tipo } => tipo.is_option(),
|
||||
_ => false,
|
||||
}
|
||||
}
|
||||
|
||||
pub fn is_map(&self) -> bool {
|
||||
match self {
|
||||
Self::Link { tipo } => tipo.is_map(),
|
||||
|
|
Loading…
Reference in New Issue