Simplify function calling.

This commit is contained in:
Stephen Chung
2020-07-31 12:11:16 +08:00
parent a7ff207636
commit cb005506e2
4 changed files with 130 additions and 99 deletions

View File

@@ -280,6 +280,16 @@ impl CallableFunction {
Self::Pure(_) | Self::Method(_) | Self::Iterator(_) => false,
}
}
/// Is this a native Rust function?
pub fn is_native(&self) -> bool {
match self {
Self::Pure(_) | Self::Method(_) => true,
Self::Iterator(_) => true,
#[cfg(not(feature = "no_function"))]
Self::Script(_) => false,
}
}
/// Get the access mode.
pub fn access(&self) -> FnAccess {
match self {