FunctionMeta
Add function to check if we can ignore the declared return type of a func
@@ -37,3 +37,16 @@ pub struct FuncMeta {
// This flag is needed for the attribute check pass
pub has_body : bool,
}
+
+impl FuncMeta {
+ /// Builtin and LowLevel functions usually have the return type
+ /// declared, however their function bodies will be empty
+ /// So this method tells the type checker to ignore the return
+ /// of the empty function, which is unit
+ pub fn can_ignore_return_type(&self) -> bool {
+ match self.kind {
+ FunctionKind::LowLevel | FunctionKind::Builtin => true,
+ FunctionKind::Normal => false
+ }
+ }
+}
