mirror of
https://github.com/erg-lang/erg.git
synced 2025-10-03 05:54:33 +00:00
Update hir.rs
This commit is contained in:
parent
bb03ca6097
commit
457e4bac76
1 changed files with 5 additions and 3 deletions
|
@ -1425,7 +1425,9 @@ pub struct Block(Vec<Expr>);
|
||||||
impl HasType for Block {
|
impl HasType for Block {
|
||||||
#[inline]
|
#[inline]
|
||||||
fn ref_t(&self) -> &Type {
|
fn ref_t(&self) -> &Type {
|
||||||
self.last().unwrap().ref_t()
|
self.last()
|
||||||
|
.map(|last| last.ref_t())
|
||||||
|
.unwrap_or(Type::FAILURE)
|
||||||
}
|
}
|
||||||
#[inline]
|
#[inline]
|
||||||
fn ref_mut_t(&mut self) -> &mut Type {
|
fn ref_mut_t(&mut self) -> &mut Type {
|
||||||
|
@ -1433,11 +1435,11 @@ impl HasType for Block {
|
||||||
}
|
}
|
||||||
#[inline]
|
#[inline]
|
||||||
fn t(&self) -> Type {
|
fn t(&self) -> Type {
|
||||||
self.last().unwrap().t()
|
self.last().map(|last| last.t()).unwrap_or(Type::Failure)
|
||||||
}
|
}
|
||||||
#[inline]
|
#[inline]
|
||||||
fn signature_t(&self) -> Option<&Type> {
|
fn signature_t(&self) -> Option<&Type> {
|
||||||
self.last().unwrap().signature_t()
|
self.last().and_then(|last| last.signature_t())
|
||||||
}
|
}
|
||||||
#[inline]
|
#[inline]
|
||||||
fn signature_mut_t(&mut self) -> Option<&mut Type> {
|
fn signature_mut_t(&mut self) -> Option<&mut Type> {
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue